2 floating point numbers are NOT "close enough".  That IS the problem.

var _str:String = "1.2e+51";
var n:Number = parseFloat(_str);
trace((n-1.2e+51) > 100000000000000000000000000000000000);  // true
_____
Ron Wheeler wrote:
If you want to know that 2 floating point numbers are "close enough" to be considered as the same value, then subtract them and check to see if the absolute value of their difference is less than your criteria for "sameness".

elibol wrote:
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-(6.3e51));

//AS3

1.32922799578491e+36

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-(6.30000000000000e+51));
// ActionScript 3.0

1.32922799578491e+36
// ActionScrpt 2.0

0

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

Reply via email to