Click to See Complete Forum and Search --> : Rounding Numeric Values
Eddy
January 1st, 1999, 03:18 AM
Hi there,
I need codes on how to round up or down a numeric value.
eg. 223.56 ==> 223 (round down)
223.56 ==> 224 (round up)
really need it for a project.
wil lreally appreciate your help.
thanks.
eddy
tie@4u.net
Maria
January 7th, 1999, 03:58 PM
Hello Eddy,
Here's what I found.
Int - always rounds down.
CInt and CLng - round to the nearest integer (for ex., 1.51 they will round up while 1.49 they will round down).
I guess you'll have to write something of your own (but probably something very small) if you need to always round up.
Good luck.
Maria.
Phasy
January 20th, 1999, 04:43 PM
Simple, if CInt always rounds up with 1.50 and down with 1.49
and you want it to always round up, just add 0.5 to your value before using CInt
and if you want to always round down, just subtract 0.5 before using CInt.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.