Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
STR() rounds numbers longer than 17 digits...?
Message
From
03/01/2001 09:37:14
 
 
To
03/01/2001 09:25:42
Andrzej Majlich
Vulcan sp. z o. o.
Wroclaw, Poland
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00458883
Message ID:
00458897
Views:
18
Hi!


? transform(-$922337203685477.5807,'99999999999999999.9999')

shows -922337203685477.5807

Looks like STR transforms currency into the numeric value that causes your problem. Transform function converts currency number without the internal convertion into numeric, that is why it works ok.

HTH.


>I've been trying my index expression after changing field type from numeric to currency: STR(price,16,2).
>As -922337203685477.5808 is the low limit for CURRENCY type numbers, I tried it in a command window:
>
>x = -$922337203685477.5807
>wait window STR(x, 21, 4)
>

>I expected '-922337203685477.5807' string but got '922337203685477.6000'.
>After some investigation I found that STR() prints only 16 most meaning digits rounding the rest:
>
>
>str(-922337203685477.5807,21,4)=='-922337203685477.6000'
>
>str(-022337203685477.5807,21,4)== '-22337203685477.5800'
>
>str(-002337203685477.5807,21,4)== '-2337203685477.5810'
>
>str(-000337203685477.5807,21,4)== '-337203685477.5807'
>

>
>Or maybe it's an effect of some misterious SET?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform