|
-
Nov 7th, 2001, 06:11 AM
#1
Thread Starter
Member
Rounding down
I have a var defined as double - I am using the round() function to set the resulting var to 1 dec place eg :
TempCalc = round( 0.15 , 1 )
Std VB setting is to round up to 0.2 - but is there a setting I can use to round down in this instance - ie the result I want is 0.1
If the value is 0.16 - then yes, I do want it to rounded up to 0.2
-
Nov 7th, 2001, 06:50 AM
#2
Frenzied Member
subtract 0.01 from your variable before rounding it
-
Nov 7th, 2001, 06:58 AM
#3
Conquistador
if it is 1.5 u should round up
-
Nov 7th, 2001, 07:06 AM
#4
Thread Starter
Member
You're not wrong - try telling my customer this !
thanks for both comments, I've found a formula on another forum that seems to work it out :
x = 0.015
X = Int(X * 100 + 0.5) / 100
returns 0.01
if x = 0.016 then returns 0.02 - sweet
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
|