HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Wc3 Real bug?

10-08-2009, 07:00 PM#1
Anachron
Collapse JASS:
         call BJDebugMsg("1/25 = " + R2S(i / 25))
Will show 0.0000.

To get the correct value, use this trick

Collapse JASS:
        local real m = 100 / 25
        set m = m / 100

        call BJDebugMsg("1/25 = " + R2S(m))
10-08-2009, 07:18 PM#2
Troll-Brain
You have the integer result, in order to have the real one, use at least one real for the division like that :

Collapse JASS:
call BJDebugMsg("1/25 = " + R2S(i / 25.0))
The 0 is unnecessary, only the "." is needed.
10-08-2009, 07:31 PM#3
Anachron
Oh yeah,.. But still good to know!
10-08-2009, 08:16 PM#4
TheKid
In your original snippet, i represents an integer. If it were a real variable then it would work correctly.
10-08-2009, 08:33 PM#5
Anachron
I only seen it as I remember that I used a variable for that calculation, which is an integer. Its really REALLY bad to find these mistakes.
10-08-2009, 11:00 PM#6
Rising_Dusk
It's not really a mistake because it makes perfect sense. 1/25 is 0 as an integer, which you're then using R2S (Since R and I are interchangeable in many regards in JASS) to show it as 0.000
10-09-2009, 07:37 AM#7
Anachron
Quote:
Originally Posted by Rising_Dusk
It's not really a mistake because it makes perfect sense. 1/25 is 0 as an integer, which you're then using R2S (Since R and I are interchangeable in many regards in JASS) to show it as 0.000
But its really bad, I saved my integer in a variable and didn't knew that, ... so actually I had 0.00 everytime, until I found that ... um.. ugly programing thing.
10-09-2009, 07:44 AM#8
Toadcop
O_o ... n/c
10-09-2009, 07:45 AM#9
Anachron
Quote:
Originally Posted by Toadcop
O_o ... n/c
Yeah.. me thinks that too now :/ Just forget this shit xD