Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with currency fields
Message
De
15/11/2001 05:24:41
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/11/2001 05:17:27
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00581922
Message ID:
00581952
Vues:
22
>>Please try this piece of code:
>>
>>CREATE CURSOR Temp (QtaOrdUMI1 Y, Coeff	N(13,6))
>>APPEND BLANK
>>REPLACE ;
>>	QtaOrdUMI1 WITH 1068.0000, ;
>>	Coeff	   WITH 0.007380
>>
>>? QtaOrdUMI1 * Coeff		&&you get 7.9032  WRONG!!
>>? 1068.0000 * 0.007380		&&you get 7.881840000 CORRECT!!
>>
>>REPLACE ;
>>	QtaOrdUMI1 WITH 1000.0000
>>? QtaOrdUMI1 * Coeff		&&you get 7.4000  WRONG!!
>>
>>I realize that VFP, before multiplaying other fields type (Coeff - Numeric) with currency fields (QtaOrdUMI1),
>>transform the Numeric type into currency type (4 decimals). The fact modifies the result.
>>Is this normal?
>>Is there a way to override this behaviour?
>>TIA
>>Bruno Maddalozzo
>
>Try :
>? mton(QtaOrdUMI1) * Coeff
>
>Cetin
I think it's from the fact that currency is rounded to 4 decimals and before multiplication an implicit conversion occurs for Coeff rounding it to 4 decimals.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform