|
-
January 1st, 1999, 04:18 AM
#1
Rounding Numeric Values
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
[email protected]
-
January 7th, 1999, 04:58 PM
#2
Re: Rounding Numeric Values
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.
-
January 20th, 1999, 05:43 PM
#3
Re: Rounding Numeric Values
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|