Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: EVL() and EMPTY() not use var decimals format
Message
From
01/05/2004 05:35:06
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
BUG: EVL() and EMPTY() not use var decimals format
Miscellaneous
Thread ID:
00900005
Message ID:
00900005
Views:
63
clear
a= -1.0
b= -0.1
c=  1.0
d=  0.1
x3= a+b+c+d 
* x3 is saved with a N(12,1)  format, in IEEE float53 binary code have a +...0000011 mantissa
x1= a+(b+c)+d
* x1 is saved with a N(12,1)  format, in IEEE float53 binary code have a -...0000001 mantissa 
x0= a+c+b+d 
* x0 is saved with a N(12,1)  format, in IEEE float53 binary code have a +...0000000 mantissa

? X3=0,X1=0,X0=0,X3=X0 
* DIRECT COMPARISON ARE OK Because VFP Evaluate this like a round(X3,1),....,ROUND(X3)=ROUND(X0)

* THE BUG : for EMPTY() VFPT it has forgotten the round(,1), then it use the pure float value
? empty(X3), empty(X1), empty(X0) && correct is .T. , .T. , .T.

* the new EVL() use the old C++ code, and replay the BUG
? EVL(X3,'X3 IS EMPTY'),EVL(X1,'X1 IS EMPTY'),EVL(X0,'X1 IS EMPTY')	

? 'USELESS WORKAROUND'
? EMPTY(ROUND(X3,1))
? EVL(ROUND(X3,1),'X3 IS EMPTY')

? 'USELESS COMPENSATION'
? EMPTY(X3+3*2^(-55))            ,EMPTY(X1-1*2^(-55))
? EVL(X3+3*2^(-55),'X3 IS EMPTY'),EVL(X1-1*2^(-55),'X1 IS EMPTY')
But on VFP the Round() have a bug, then for some values, the round result can to be incorrect.
Next
Reply
Map
View

Click here to load this message in the networking platform