Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to deal with some limitations
Message
From
05/12/2003 11:54:36
 
 
To
05/12/2003 08:24:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00856215
Message ID:
00856317
Views:
18
This message has been marked as a message which has helped to the initial question of the thread.
Since you are dealing only with small numbers you could use Fox' builtin currency type, which is a 64-bit signed integer scaled by 1/10000. This gives you 18.96 digits of precision - you just have to scale your input values down and remove the decimal separator after transforming the result.

We use this for calculating the checksums over bank instution numbers and banking account numbers when we generate money transfer data (these 17-digit checksums are required for the DTA format here in Germany). In this case the 'input transformation' is just
val("$" + stuff(padl(alltrim(m.cNum), 17, "0"), 14, 0, set("POINT")))
where cNum is an account number, checksum string or whatever. The constants 17 and 14 (= 17 - 4 + 1) need to be adjusted if your input strings can be longer, because otherwise PADL() would silently trim any excess length and even if it didn't then STUFF() would put the decimal separator in the wrong place.
Previous
Reply
Map
View

Click here to load this message in the networking platform