Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Currency problems
Message
From
12/03/2004 05:38:33
 
 
To
12/03/2004 02:08:51
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00885487
Message ID:
00885521
Views:
8
You can have roundin problems, but this is a solution:
CREATE CURSOR test (field1 y,field2 I)
INSERT INTO test(field1,field2) VALUES (123456789012345.6789,123456789)

SELECT IIF(LOG(field1)+LOG(field2)>LOG(922337203685477.5807),$922337203685477.5807,field1*field2) as newfield;
from test;
INTO CURSOR new && CURRENCY VALUE OUT OF RANGE ERROR
BROWSE
A solution without rounding problem, but slow is
CREATE CURSOR test (field1 y,field2 I)
INSERT INTO test(field1,field2) VALUES (123456789012345.6789,123456789)

SELECT boundcurrency(field1,field2) as newfield;
from test;
INTO CURSOR new && CURRENCY VALUE OUT OF RANGE ERROR
BROWSE

function boundcurrency(yX,nY)
 TRY
   STORE m.yX*m.nY to yX
 catch
   store $922337203685477.5807 to yX
 endtry
 return m.yX
endfun
Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform