Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to format a currency fields ?
Message
De
05/12/1999 08:16:59
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00294286
Message ID:
00298832
Vues:
21
,
>
>The problem is NOT currency fields, it is when you do your rounding. For example, check the difference in these two sums;
>
>
>           Values    Not Rounded   Rounded
>            12.9999    12.9999       13.00
>            12.1190    12.1190       12.12
>            12.9958    12.9958       13.00
>            12.4998    12.4998       12.50
>            50.6145    50.6145       50.62
>Rounded to 2 decimals  50.61         50.62
>
>
>This short list of 4 values is off by .02, if we had 100,000 transactions then the differnece would be 2,000.

Hi Jim,
In my examle was no rounding involved (at least not with a function):
formula:
( lnAmount*.05746*30/360 ) - ( lnAmount * lnLiborRate * lnNumberOfDays /360)
here are the ariables:
lnAmount=100000000
lnLiborRate =.05
lnNumberOfDays =30
?( m.lnAmount*.05746*30/360 ) - ( m.lnAmount * lnLiborRate * lnNumberOfDays /360) returns 621666.66667
now:
create cursor dummy (lnAmount Y)
append blank
repl lnAmount with m.lnAmount
?( lnAmount*.05746*30/360 ) - ( lnAmount * lnLiborRate * lnNumberOfDays /360)
returns 6250000

To me that is not rounding per se (I know it is rounding to the 4 built in decimals of the currency type), and therefore unusable

Peter
Peter Cortiel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform