Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EMPTY() Bug - Review
Message
De
30/04/2004 06:47:58
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00899617
Message ID:
00899652
Vues:
12
Hi Marvin,

yes EMPTY() use only float53 domain for computation,
but also a direct use of a fractional variable one
can return values mathematically mistakes to you ( but correct results into the VFP logic ! )
clear
local a, b, c, d,x
a= -1.0
b= -0.1
c= 1.0
d= 0.1
x= a+b+c+d  && x is saved with a N(12,1)  format, in IEEE float53 binary code

? X=0 && THIS IS OK BECAUSE vfp EVALUATE THIS like a round(x(code),1)

? empty(x),empty(ROUND(x,15)),empty(ROUND(x,16)) && empty not use the format, and use direct float53 value <=== This is the bug

? X*2^55 && with this you found the float53 sum rounding, and you see that X is not zero
? EMPTY(x+2^(-54)+2^(-55)) && this compensate the float53 error rounding, and EMPTY return correct result

* then the question is: you can use x directly ? 
* yes, but with a great attention:
? x  	,'x   is zero ?' at 40, x=0   at 70   && x is zero in N(*,1) domain, but it is not zero in float53 domain
? x*1	,'x*1 is zero ?' at 40, x*2=0   at 70 && x is zero in N(*,1) domain
? x*1.00000000000	,'x*1.00000000000 is zero ?' at 40	, x*1.00000000000=0  at 70  && x is zero in N(*,12) domain
? x*1.000000000000	,'x*1.000000000000 is zero ?' at 40	, x*1.000000000000=0 at 70   && x is zero in N(*,13) domain
? x*2^0				,'x*2^0 is zero ?' 	at 40			,x*2^0=0 at 70  && x is not zero in float53 domain
Fabio
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform