I came to this specific value from 6.3e51. Here are some more tests:
var test1_str:String = "6.3e51"; //6.3e+51 outputs same result. var n1:Number = parseFloat(test1_str); trace(n1); trace(n1 == (6.3e51)); trace(6.30000000000000e+51 == 6.3e+51); trace(n1-(6.3e51)); //AS3 6.30000000000000e+51 false true 1.32922799578491e+36 It may certainly be by design, but aren't these unexpected results? as2 and java do not behave this way. The parseFloat function is flawed. I will post a comment on livedocs, and I've submitted the issue as a bug at http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform I am not going over board am I? I just need my program to work correctly. On 3/5/07, Fumio Nonaka <[EMAIL PROTECTED]> wrote:
I am not sure whether it is a bug or by design, though. var test0_str:String = "6.30000000000000e+51"; var n0:Number = parseFloat(test0_str); trace(n0); trace(n0 == (6.30000000000000e+51)); trace(n0-(6.30000000000000e+51)); // ActionScript 3.0 6.30000000000000e+51 false 1.32922799578491e+36 // ActionScrpt 2.0 6.3e+51 true 0 Decrease one digit: var test1_str:String = "6.3000000000000e+51"; var n1:Number = parseFloat(test1_str); trace(n1 == (6.3000000000000e+51)); trace(n1-(6.3000000000000e+51)); // ActionScript 3.0 true 0 _____ elibol wrote: > Those who are interested in helping me verify the problem can run this test > in actionscript 2.0 and again in actionscript 3.0. > > var a:String = "6.30000000000000e+51"; > var b:String = "23"; > var c:Number = parseFloat(a)%parseFloat(b); > trace(c); //outputs 7 in as3, and 18 in as2 > trace(6.30000000000000e+51%23); // outputs 18 in both as2 and 3 Good luck, -- Fumio Nonaka mailto:[EMAIL PROTECTED] http://www.FumioNonaka.com/ My books<http://www.FumioNonaka.com/Books/index.html> Flash community<http://F-site.org/> _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com