[Javascript] INCREDIBLE IE BUG!!!!

Peter Brunone peter at brunone.com
Mon Oct 13 09:24:19 CDT 2003


	Yeah, but I've never noticed it with such "large" (comparitively
speaking) numbers in other environments, assumedly because the variant
datatype used in VBScript and JavaScript doesn't use quite as many bytes
to get the job done.

Ah, the wonderful world of web scripting...

-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of Cutter (JavaScript
List)
Sent: Monday, October 13, 2003 7:49 AM
To: [JavaScript List]
Subject: Re: [Javascript] INCREDIBLE IE BUG!!!!


This happens on most any computer, regardless of browser or OS. Floating

Point operations are very iffy due to how many bits are used to 
represent a number. Some programming languages have built in classes to 
compensate for the issue, but it's good to write your own error 
correction on this. One of the most commonly seen js programs containing

this error are loan calculators. I didn't realize this was an issue 
until a bank (whom I was developing a site for) pointed out the error. 
Lot's of fun writing the work around;)

Cutter

Peter Brunone wrote:

>    Dang.  So now we need to round whenever performing floating point 
>operations...
>
>    Any idea if this happens on previous versions of IE?
>
>-Peter
>
>-----Original Message-----
>From: javascript-bounces at LaTech.edu On Behalf Of Dan Costea
>
>    Hi to all,
>
>If I'm blind or dreaming, please, let me know, but, try this first:
>
>It's easy to make the following sum in your head:  0.15 + 0.015 = 0.165
>(OBVIOUS!)
>
>TRY THIS IN YOUR IE 6 WITH SP1:  alert (0.15 + 0.015); you will obtain:

>164999999999999998
>OR:
>alert (0.15 + 0.015 - 0.15 - 0.015);  - I think the result is obvious 
>for any human, but not for IE, that will return: 
>-1.3877787807814457e-17 (that indeed, is almost 0, but not realy 0...).
>
>I still can't believe it! And of course, those are not special numbers.

>You can find many, many more (ex: 0.15+0.075, or 0.14+0.016) - I think 
>the bug is in the cases that the sum of the last digit of each number 
>is 10, and the number of digits representing the precision is 
>different.
>
>Regards,
>Dan Costea.
>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu 
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list