Jump to content
Sign in to follow this  
laffo16

The strangest of number (float) glitches

Recommended Posts

laffo16

ok guys, i stumbled across something unusual this morning, at first it was baffeling but with a little perciverance i found the problem!

example code: (sry its a bit chunky)

Global $odds_arr[352]
    $COA_num = 1.00
    $COA_int = 0
    While 1
        $COA_int += 1
        If $COA_num >= 1.00 And $COA_num <= 1.99 Then
            $COA_num += 0.01
        ElseIf $COA_num >= 2 And $COA_num <= 2.98 Then
            $COA_num += 0.02
        ElseIf $COA_num >= 3 And $COA_num <= 3.95 Then
            $COA_num += 0.05
        ElseIf $COA_num >= 4 And $COA_num <= 5.90 Then
            $COA_num += 0.10
        ElseIf $COA_num >= 6 And $COA_num <= 9.80 Then
            $COA_num += 0.20
        ElseIf $COA_num >= 10 And $COA_num <= 19.50 Then
            $COA_num += 0.50
        ElseIf $COA_num >= 20 And $COA_num <= 29 Then
            $COA_num += 1
        ElseIf $COA_num >= 30 And $COA_num <= 48 Then
            $COA_num += 2
        ElseIf $COA_num >= 50 And $COA_num <= 95 Then
            $COA_num += 5
        ElseIf $COA_num >= 100 And $COA_num <= 990 Then
            $COA_num += 10
        EndIf
        
        MsgBox(0, $COA_num, Round($COA_num, 2))
        
        $COA_num = Round($COA_num, 2)
        $odds_arr[$COA_int] = $COA_num
        ;_ArrayDisplay($odds_arr, "")
        If $COA_num >= 1000 Then
            ExitLoop
        EndIf
    WEnd
    $odds_arr[$COA_int+1] = 0

as some of you may know, some of the lower number (float / decimals) have trouble converting into an exact number, this is why i use "$COA_num = Round($COA_num, 2)" to make sure the number is rounded nicely before adding it into my array. however this morning, it was back to square one and the numbers were doing funny things again. i turned my clock back a day thinking it might be a new month a new bug curse (rofl), but no that wasnt it, infact it turned out to be a conflict with GunCam (http://www.growlersoftware.com/), which is a screen recording software, 14 day trial and good software btw.

yeh for some reason when GunCam is running (from the tray), it causes the Round() function not to operate, as far as i can tell. is this just my comp playing up or what?

Edited by laffo16

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.