Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rounding problem?
Message
 
 
To
20/03/2000 16:47:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00348122
Message ID:
00348125
Views:
22
Hi Janet,

This is strange, but that I had as a quick test:
? .35000000 * 943.0 *.100
? ROUND(.35000000 * 943.0 *.100 ,2) 
? ROUND((.35000000 * 943.0 *.100) ,2)
? .35000000 * 943.0 *.100
? ROUND(.35000000 * 943.0 *.100 ,2) 
? ROUND(33.005000000000,2)
lnNumber= .35000000 * 943.0 *.100
? ROUND(lnNumber,2)
lnNumber= .35000000 * 943.0 *.100
? lnNumber
? ROUND(lnNumber,2)
=messagebox(str(lnNumber,30))
=messagebox(str(lnNumber,30,15))
=messagebox(str(lnNumber,30,10))
=messagebox(str(lnNumber,30,20)) && gives an error
=messagebox(str(lnNumber,40,20)) && gives an error
=messagebox(str(lnNumber,40,18))
? round(33.005,2)
? round(lnNumber,2)
? lnNumber==33.005
? (lnNumber==33.005)
? (lnNumber==33.00500000)
? lnNumber
It seems like lnNumber<>33.005 for some reason... VFP bug?????


>When the following numbers are multiplied then rounded to two decimals the result is 33.00 instead of the expected 33.01.
>
> .35000000 * 943.0 *.100 = 33.005000000000
> ROUND(.35000000 * 943.0 *.100 ,2) = 33.00
>
> ROUND(33.005000000000,2) = 33.01
>
>The numbers are straight from the command window - not from a table. Is this normal rounding behavior that I don't know about?
>
>Thanks for any info!
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform