Re: round up

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Evertjan. (exjxw.hannivoort_at_interxnl.net)
Date: 02/19/04


Date: 19 Feb 2004 00:01:58 GMT


=?Utf-8?B?am9lYW5kdGVs?= wrote on 18 feb 2004 in
microsoft.public.inetserver.asp.general:

> If I have a value that is 53.123499999, how can I round it to 53.12?

The old and safe way:

n = 53.123499999

n = int( n * 100 + 0.5 ) / 100

n = int(n) / 100

Response.Write FormatNumber(n,2)

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


Relevant Pages