HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

i2r - issue

08-28-2006, 01:05 PM#1
Toadcop
So how i sad the real handle indexes are precached ! that mean you cannot return real like this correct
Code:
    set tmp=r2i(14356683.963)
    call DisplayMessage(R2S(i2r(tmp))) // it will return only 14356683.000 !
    set tmp=r2i(13.963)
    call DisplayMessage(R2S(i2r(tmp))) // it will return only 13.963 !
  

all real handles are CONSTANT and can't be created a new ones !

so make own tests ot understand this... !

sorry i am bad in explaining...
08-28-2006, 02:26 PM#2
Captain Griffen
You can't have an 11 digit real. It just cannot handle it to that degree of accuracy.
08-28-2006, 04:05 PM#3
Vexorian
if so, the logical result would be 14356684.000
08-28-2006, 04:35 PM#4
Captain Griffen
Quote:
Originally Posted by Vexorian
if so, the logical result would be 14356684.000

Checked. Gives 14356683.000.
08-28-2006, 07:38 PM#5
PipeDream
The logical result is whichever floating point number is closest. Ironically it is in fact 4, which just goes to show you how busted warcraft's floating point implementation is (or maybe truncation is the standard? shrug). If you want an "exact" floating point number, enter it in hex (or octal I guess). I like to use http://www.h-schmidt.net/FloatApplet/IEEE754.html

Anyway there isn't *really* a bug here, this is just how floating point aren't real numbers. It's messy, people have made careers studying the properties of floating point numbers.
08-31-2006, 11:35 AM#6
Toadcop
PipeDream - no the reals are not buged ! only i2r() funcs can return only precahed reals whats all !