Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Round() Bug
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Round() Bug
Miscellaneous
Thread ID:
00459503
Message ID:
00459503
Views:
54
Hi,

I wrote a new function to handle the round() bug that exists in VFP. I was curious if anyone sees a reason that this won't work.

Thanks,
Paul
lparameters tnNumber tndecimals

* The reason we added this new round function is because Microsoft has confirmed a bug with the round() command
* after doing several calculations on the variable you are trying to round.
* http://support.microsoft.com/support/kb/articles/Q157/9/54.asp?LN=EN-US&SD=msdn&FR=0&qry=round%28%29&rnk=3&src=DHCS_MSPSS_msdn_SRCH&SPR=FOX
* Article ID: Q157954

* basically we are  change the number to a string with the # of decimal positions calculated by
* adding one to the precision that is desired. then switching the string back to numeric.

return round(val(alltrim(str(tnNumber,20,tnDecimals+1))),tndecimals)
Next
Reply
Map
View

Click here to load this message in the networking platform