There's nothing wrong with fallout's division.
Outputs 1, 1.00000, 1.00000, 1.00000, 1, 1.50000, 1.50000, 1.50000. Just like I'd expect it to.
Note that there's a huge difference between 1 and 1.0 in computing terms; if you put two integers into a division, you will get an integer out. If you have two integer variable and need to divide them, but want a floating point result, add 0.0 to one of them before doing the division. (Similar to the '""+...' trick to turn things into a string)
Where there certainly is a problem is in the sfall script compilers constant folding when floats are involved. If you compile the top script with optimization turned on, you get:
//1, inf, 0.00000, 1.00000, 1, inf, 0.00000, 1.00391
That's definitely something I'll fix if I ever get some time to make another release, and is presumably the cause of the weird answer you got from 2.000/3.000. The bug wont effect variables, only when both sides are constant, but if there's a chance of you doing that make sure you turn optimization off.
script said:display_msg(""+(2/2)); //Should be 1
display_msg(""+(2.0/2)); //Should be 1.0
display_msg(""+(2/2.0)); //Should be 1.0
display_msg(""+(2.0/2.0)); //Should be 1.0
display_msg(""+(3/2)); //Should be 1
display_msg(""+(3.0/2)); //Should be 1.5
display_msg(""+(3/2.0)); //Should be 1.5
display_msg(""+(3.0/2.0)); //Should be 1.5
Outputs 1, 1.00000, 1.00000, 1.00000, 1, 1.50000, 1.50000, 1.50000. Just like I'd expect it to.
Note that there's a huge difference between 1 and 1.0 in computing terms; if you put two integers into a division, you will get an integer out. If you have two integer variable and need to divide them, but want a floating point result, add 0.0 to one of them before doing the division. (Similar to the '""+...' trick to turn things into a string)
more code said:var a=3, b=2;
display_msg(""+(a/b)); //Will print 1
display_msg(""+((a+0./0)/b)); //Will print 1.50000
Where there certainly is a problem is in the sfall script compilers constant folding when floats are involved. If you compile the top script with optimization turned on, you get:
//1, inf, 0.00000, 1.00000, 1, inf, 0.00000, 1.00391
That's definitely something I'll fix if I ever get some time to make another release, and is presumably the cause of the weird answer you got from 2.000/3.000. The bug wont effect variables, only when both sides are constant, but if there's a chance of you doing that make sure you turn optimization off.