Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transform() bug
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00158067
Message ID:
00158171
Views:
13
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform