[Javascript] Monetary Rounding (always up)
Roland Corbet
Roland at psyche.net.uk
Mon Aug 6 12:42:05 CDT 2001
I'm currently writing an order form calculator, and need to round the final
value to two decimal places. This is fine, and works, following the 0.5
rule. However, as it is currency, I could really do with always rounding
up.
Is there any other way than splitting the number down after the decimal
place, and then manually adding on 0.01 if the third number after the
decimal point is greater than zero.
If anyone's already got a snippet of code to do this, it would be
appreciated. Alternatively, if there's an easier way, I'd like to know that
too.
TIA for your help.
Kind regards,
Roland
More information about the Javascript
mailing list