Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rounding problem?
Message
From
21/03/2000 11:48:45
Paul Frost
Instem Computer Systems Ltd
Stone, United Kingdom
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00348122
Message ID:
00348430
Views:
34
I agree that it's not the best way to do such calculations (though for some calculations, setting it out in such a manner, clarifies what is being done, without the need for explicit comments).

But it is a matter of some concern that
a = 0.3500000000
b = 943
c = .1
round( a * b * c, 2 ) # round( 0.3500000000 * 943 * .1, 2 )

e.g. where else are such little discrepancies hidden, should all use of literals in expressions be avoided ?

A lot of the code I produce is used in calculating duty payable to Customs & Excise, from calculations similar to these. All of the calculations use variables, so no (apparent) problem. If checks were performed on my results though, two seemingly identical calculations, as above, returning different results could seriously undermine the clients view of the reliability of the entire system.

Paul
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform