Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Currency problems
Message
De
12/03/2004 02:33:42
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
 
À
12/03/2004 02:08:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00885487
Message ID:
00885491
Vues:
12
>Dear Experts,
>
>I have the following situation.
>
>I'm using some cursors with currency fields. The problem I get is currency overflow when the result of a multiplication exceeds the maximum currency or numeric value.
>
>For example:
>
>case 1:
>** Using currency for calculations
>CREATE CURSOR test (field1 y,field2 I)
>INSERT INTO test(field1,field2) VALUES (123456789012345.6789,123456789)
>
>SELECT IIF(field1*field2>922337203685477.5807,922337203685477.5807,field1*field2) as newfield;
>from test;
>INTO CURSOR new && CURRENCY VALUE OUT OF RANGE ERROR
>
>case 2:
>** Using numeric for calculations
>CREATE CURSOR test (field1 n(16,4),field2 I)
>INSERT INTO test(field1,field2) VALUES (123456789012345.6789,123456789)
>
>SELECT IIF(field1*field2>999999999999999.9999,999999999999999.9999,field1*field2) as newfield;
>from test;
>INTO CURSOR new && NO ERRORS
>
>The case I'm interested is case 1. Unfortunately I cannot use Numeric for all the calculations.
>
>Can anyone help my solve this problem? (except from changing my fields to numeric)

Check out the MTON() and NTOM() functions. Also be aware that VFP in general won't return results accurate to more than 15 significant figures; it's a limitation of VFP's floating-point arithmetic.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform