IIS 7 and Above
classic ASP giving a wrong answer to a maths calc!
Last post Jan 31, 2018 11:08 AM by mtm81
Jan 31, 2018 10:57 AM|mtm81|LINK
Hi, Can anyone give me a work-around for this please?
If you have a classic ASP page with the following:
<% response.write 1.0668 - 1.01885 &"<br>" %>
This 'should' give you the answer of:
but in reality gives:
Through experimentation I can see that the issue relates to the number of decimal places in the second number AND that fact it ends in a five. (If I change that end number from a 5 to a 4 for example -it works it out correctly. Also, if I reduce the number
of decimal places in the second number (but still have it ending with a 5), again, it works out it correctly.
So the 'bug' appears to be related to a number with "at least" 5 decimal places ending in a 5.
I've tried the usual cdbl() and formatnumber() without any success.
Jan 31, 2018 11:08 AM|mtm81|LINK
ok all sorted.
For any interested, the lack of non-zero digits in the answer was showing that number (with the "E" sufffix giving a clue to the number of zero digits present).
To see this as an actual number I then had to surround this with a formatnumber tag and all appeared ok!