sk5567
asked on
Rounding and Precesion in Javascript
Hi
I want to format the user entered number with 14 digit precision. I am getting problem if i enter large number and in particular while rounding it.
For Example
123.45 should become 123.45000000000000 This works fine for me.
If I enter 12345.1234567890123456, this is becoming 12345.123456789013 which is wrong.
The number it should show is 12345.12345678901235.
Any Help?
I want to format the user entered number with 14 digit precision. I am getting problem if i enter large number and in particular while rounding it.
For Example
123.45 should become 123.45000000000000 This works fine for me.
If I enter 12345.1234567890123456, this is becoming 12345.123456789013 which is wrong.
The number it should show is 12345.12345678901235.
Any Help?
More articles:
http://www.aplawrence.com/Basics/floatingpoint.html
http://www.aplawrence.com/Basics/floatingpoint.html
Just a suggestion as I'm not in tune with what Zvonko is saying.
1234.12345678901234
array = split()
array(1) = array(1) * 10000 // = 1234.568901234
array2 = split(array(1))
array2(1) = array2(1)*10000 // = 5678.901234
until you get to something managable maybe.
1234.12345678901234
array = split()
array(1) = array(1) * 10000 // = 1234.568901234
array2 = split(array(1))
array2(1) = array2(1)*10000 // = 5678.901234
until you get to something managable maybe.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
exactly!
Good Job lil_puffball
Good Job lil_puffball
thank you, yoshi. :)
sk5567,
Is there any reason for the B? :(
Is there any reason for the B? :(
http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html