
July 9th, 2001, 06:09 AM
|
|
Contributing User
|
|
Join Date: May 2001
Location: The Netherlands
Posts: 200
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
var x,y,z,a;
x = 12.345;
y = 67.89;
z = x*y;
// adding 0.005 to simulate a round()
// parseInt just chops off everything following the .
a = parseInt(100*(z+0.005))/100;
this will show numbers with at most 2 decimals
when you want exactly 2 decimals, you should use strings
possible in combination with above solution
(convert to string, check length after dot, append 0,1,2 zero's)
|