Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ROUND()
Message
From
13/03/2000 13:33:16
 
 
To
13/03/2000 04:40:12
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00342568
Message ID:
00345055
Views:
36
>The point I am making, is that I have a variable containing the sum, and I want that result rounded to one decimal place (9.5), I then want to issue ROUND() on this variable ROUND(nVar,0) to give me 10. But ROUND() insists on knocking the decimal places back to 9.46.
>
>It's not the mathmatical side of it that bothers me, it's the fact that I want ROUND() to round 9.5 and not 9.46.

Maybe you missed this or I didn't explain it well enough. Since you want to round your value assuming only one decimal place, you can add 1/2 of the next decimal place unit to the number. In your case that would be .05 to be added.

So 9.46 + .05, rounded to 0 places would yield 10. 9.44 + .05 would still yield 9, while 9.45 + .05 would yield 10.

ROUND(7/74*100+.05,0) --> 10
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform