|
-
Sep 6th, 2000, 09:47 AM
#1
Thread Starter
Lively Member
I am using VB6 professional and need to round a number up to the next integer. I understand that the Round Function will round down for decimals less than 0.5 and round up for decimals 0.5 or greater. I need to round up to the next integer for all decimal values, no matter how small (or at least to 4 decimal places). I am new to Visual Basic so please bear with me. Any code examples would be very welcome.
Thanks,
Steve.
-
Sep 6th, 2000, 10:05 AM
#2
Frenzied Member
This will help ya!
There was a post at 31-8-2000 about the same subject, so take a look at it!
http://forums.vb-world.net/showthrea...threadid=28747
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 6th, 2000, 10:06 AM
#3
Lively Member
Try this:
Code:
y = Int(x) + IIf(x = Int(x), 0, 1)
-
Sep 6th, 2000, 10:18 AM
#4
Lively Member
I use
Fix(num + .5)
if negative number want to round down then
Fix(num + .5 * Sgn(num))
-
Sep 7th, 2000, 05:18 PM
#5
Lively Member
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
|