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:
Miscellaneous
Thread ID:
00459503
Message ID:
00459548
Views:
30
>>Why the arbitrary length of 20? The article suggests the workaround of changing it to a string and back to numeric, so how about just
ROUND( VAL( TRANSFORM(tnNumber)), tnDecimals)

>
>?transform(tnnumber)
>tnnumber=2.0000000056984984924892482948294829
>?transform(tnnumber)
>tnnumber=2.00000000569
>tnnumber=0.00000000569
>?transform(tnnumber)
>tnnumber=0.02000000569
>?transform(tnnumber)
>?val(transform(tnnumber))
>
>The maximum number of decimals, BTW, is 12, as I just found.
tnnumber=2.0000000056984984924892482948294829
?round(val(str(tnnumber,20,16)),15)
Doesn't work correctly...
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform