|
|
 |
|
|
Pages: 1
JavaScript Rounding
(Click here to view the original thread with full colors/images)
Posted by: Canis Lupus
Hmmm, haven't tried this before, but try these links:
http://developer.netscape.com/docs/...t/rounding.html
http://www.imbs.com/devedge/docs/ex...ri/rounding.htm
[ March 25, 2001: Message edited by: Canis Lupus ]
Posted by: Scav
I thought Javascript could calculate exactly like 12.99 + 11.99 + 15.99 + 13.99 but somewhere along the line it screws up and the answer has a lotta extra numbers at the end.
I read somewhere that its because of the way the computer transfers information its impossible for it to acurately represent those numbers.
Well does anyone know what the JavaScript Command to round up is? so instead of like 14.96999999999999999999999999 it is 14.97?
Posted by: DemonBob
The command is round() I believe
used like this y = Math.round(x)
Posted by: Scav
ya but that would round 12.99 up to 13 in order to use that I would have to find a way to split the number 12.99 in half using the decimal point like you can in cgi but then if i was gonna do that i might as well rewrite the whole thing in cgi and it looks like thats my only option 8(.
|
|
|
|
|