Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why 1/2000000=0 is true ? BUG ?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00824749
Message ID:
00824779
Views:
46
>Hi,
>
>i have understand this:
>vfp numeric variables or litterals is a double with a format.
>
>Then, computations is correct, but value show can change.
>
>Then, why comparison of values can fail ?
>
>
>? 1/1999999 = 0
>* ok : false
>? 1/2000000 = 0
>* NOK : true
>x = 1
>? x/2000000 = 0
>* ok : false
>? 1/2000000.0 = 0
>* ok : false
>? 1/20000000.0 = 0
>* NOK : true
>
>
>For any unknown information, VFP use a ROUND(,5) for litterals interger
>divisions.
>
>For correct computation, is need to add decimals zeros, but the number of
>zero change the values ( not the display format ) !
>
>For me this is a bug.
>
>Fabio

It has to do with what SET DECIMALS is set to. When set to 10, the above doesn't occur when you type the variable to double, float or currency. More than anything else, this is a doc error with the SET DECIMALS description.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform