Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why 1/2000000=0 is true ? BUG ?
Message
 
 
To
30/08/2003 03:09:06
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00824749
Message ID:
00824797
Views:
21
Fabio,

The VFP Numeric variables ('N') are stored either as Long Integers or Double float point numbers. If you want better precison, force VFP to use float arithmetic.
? 1.0*1/200000 = 0 
* or
? 1.0/200000 = 0
* or
? 1/200000.0 = 0
>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
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform