Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Empty()??? Is this true!
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00940054
Message ID:
00940061
Views:
16
>Check this out!
>Run this:
>
>x=199.07
>x=x - 185.27
>x = x  - 13.80
>?"---"    && Result
>?x        && Print 0.00
>?EMPTY(x) && Print .F.
>
>
>Anyone know why?

Jean-Rene,

this is due to the arithmetic in double precision.
vfp keeps track of the number of (significant ??) decimals that were used when the variable was defined and used in calculations

empty() does not take the number of decimals into account where (x=0) does (2nd example)
x=199.07
x=x - 185.27
x = x  - 13.80
?empty(x) && FALSE
??x-0.000000000000000000000000000000   && -0.000000000000018000

?(x=0)  && TRUE

&&----------------------------------
x=199.07
x=x - 185.2700000000000000000000000
x = x  - 13.8000000000000000000000000000000

? x && -0.000000000000018000

?empty(x) && FALSE
?(x=0)  && FALSE !!!!
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform