| 03-22-2010, 07:13 PM | #1 |
This makes absolutely no sense: JASS:scope test initializer init public function init takes nothing returns nothing local real r = 1. //- .05 + .05 if (r == 1.) then call BJDebugMsg("r==1.") else call BJDebugMsg("r!=1.") endif if (r != 1.) then call BJDebugMsg("r!=1.") else call BJDebugMsg("r==1.") endif endfunction endscope As it is, it will display "==1" twice in-game. If you remove the comment, it displays both "==1" and "!=1". How on earth can it satisfy both conditions. This is so lame, it even screws up the R2I function which makes R2I(1.+.05-.05) not equal to 1. Instead it returns 0. |
| 03-22-2010, 07:24 PM | #2 |
It has something to do with == and != are compared differently. I believe == uses an epsilon approach where as != uses a bit comparison approach. Aka, == allows for slight changes and still return true while != requires pretty much the exact same number. http://www.cygnus-software.com/paper...ringfloats.htm |
| 03-22-2010, 07:32 PM | #3 | |
Good to know. Quote:
: ( |
