PDA

View Full Version : Absolute screamer of a MAKI floating point bug ...


DJGrenola
15th June 2002, 02:31
This one has *really* annoyed me, as it's effectively going to stop development on my generalised curved volume slider script until it's fixed.



System.onScriptLoaded () {

messageBox ("started", "", 0, "");

Float f1 = 10;
messageBox (floatToString (f1, 10), "", 0, "");
Float f2 = 20;
messageBox (floatToString (f2, 10), "", 0, "");
Float f3 = (f1*f1 - f2*f2);
messageBox (floatToString (f3, 10), "", 0, "");
Float f4 = 1 / f3;
messageBox (floatToString (f4, 10), "", 0, "");

messageBox ("success!", "", 0, "");

}



Winamp beta 3 crashes when it attempts to evaluate f4 (and no, before you ask, it isn't a division-by-zero). I've not tried it with the other builds yet, but it's seriously in need of a fix. I mean, adding poncey new Rectangle classes to the new builds is all very well, but when your floating-point code contains a flaw like this, I reckon a bit more work needs to be done on the core language.

Can someone else *please* compile this and see what happens to them ?

DJG (furious)

thepyr0x
15th June 2002, 02:41
Originally posted by DJGrenola


System.onScriptLoaded () {

messageBox ("started", "", 0, "");

Float f1 = 10;
messageBox (floatToString (f1, 10), "", 0, "");
Float f2 = 20;
messageBox (floatToString (f2, 10), "", 0, "");
Float f3 = (f1*f1 - f2*f2);
messageBox (floatToString (f3, 10), "", 0, "");
Float f4 = 1 / f3;
messageBox (floatToString (f4, 10), "", 0, "");

messageBox ("success!", "", 0, "");

}
now I'm no scripting guru; but shouldnt it go Float f4 = (1 / f3);
??
try that see if it works

DJGrenola
15th June 2002, 02:57
That didn't seem to help, but I found something which did: the floating point code itself is fine, but it seems to be the message boxes which are causing it to crash. I dunno whether there's a bug in the floatToString() method, or whether it's just something wrong with the messageboxes, but removing the debugging code seems to do the trick. Which is a bit bizarre. Shrug.

DJG

DJGrenola
15th June 2002, 03:07
Yeah, it seems to be the floatToString() method. This:



Float f1 = 10;
Float f2 = 20;
Float f3 = (f1*f1 - f2*f2);
Float f4 = (1 / f3);
String s = floatToString(f4, 10);



crashes it, but this:



Float f1 = 10;
Float f2 = 20;
Float f3 = (f1*f1 - f2*f2);
Float f4 = (1 / f3);



... seems fine.

DJG

spleen
15th June 2002, 10:26
Yes, floatToString() method chashes Beta 3 in some cases.
Don't know which ones, but it has a bug that chrashes Wa3.
I think that it is fixed in later developer releases.