Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transform() bug
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00158067
Message ID:
00158171
Vues:
15
>Run this code in VFP6.0!
>
>What's up with this behavior?
>Does Microsoft know about this?
>
>**-- TRANSFORM() bug???
>SET DECIMAL TO 6
>x=8705014.002708
>? TRANSFORM(x)
>* Yields 8705014.002707999
>? TRANSFORM(x, '9999999.999999')
>* Yields 8705014.002708
>SET DECIMAL TO 9
>? TRANSFORM(x)
>* Yields 8705014.002707999
>? TRANSFORM(x, '9999999.999999')
>* Yields 8705014.002707
>
>If you change any of the digits around, the result changes, I'm beginning to think that TRANSFORM() is unreliable!

Looks like a combination of binary storage and string truncation is going on. Clearly, from your example, this is risky business. On the bright side, I was able to get the original x value back with:

? ROUND(VAL(TRANSFORM(x,'9999999.9999999')),6)

for SET DECI TO 9 :)
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform