HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Are reals floats?

03-02-2004, 06:46 PM#1
weaaddar
Question says all. I know reals store more decimal places then three thanks to the return bug, but I don't know if they comply to the float specifcation.
From my basic knowledge a float is made up of such
1 bit for sign, 9 bits for exponent, 22 bits for mantissa.

The java specification (just read the Float wrapper classes comments about float to int bits) tells you how to compile such a number to its float form from bit but I don't know how to do such actions as bitwise and and the like in jass.
Code:
(bits is the hex make up of the float)
 int s = ((bits >> 31) == 0) ? 1 : -1;
 int e = ((bits >> 23) & 0xff);
 int m = (e == 0) ?
                 (bits & 0x7fffff) << 1 :
                 (bits & 0x7fffff) | 0x800000;
03-02-2004, 07:34 PM#2
COOLer
That sounds about right for java. For c++ and other langs floats are differnt then doubles. Doubles are closer to reals in my gess since the dec does not float. In java or C++ i always use doubles never floats.
03-03-2004, 03:09 PM#3
Tyraxor
Dont know if this might help you:

Integer -2147483648 to 2147483647 (integer) (eg 2; 3;..)
Real 5.0 x 10324 .. 1.7 x 10308 (float) (eg 1,342...)
03-04-2004, 01:27 PM#4
cangrejo
Erhm, they are most certainly floats.. or doubles.. but double is just float with double accuracy..

(since warcraft 3 is programmerd in c++ )