Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Diff. between Numeric with precision, Currency and Doubl
Message
De
11/06/2003 08:17:45
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
10/06/2003 14:27:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00798235
Message ID:
00798830
Vues:
25
>Hi,
>
>this is the rule:
>
>If field is a coefficient for moltiplication, you can use double.
>
>If you use field on sum, double it must be forgotten.
>
>Numeric field on VFP they are implements in not efficient way, but if you sums a million values, you will not have been strange result.
>
>Currency is only numeric field sure.
>
>Fabio

Currency is the only one for sure ???
OK your tests modified a bit :
CREATE CURSOR TEST (v Y)
APPEND BLANK
FOR I=1 TO 10000
 REPLACE v WITH v+0.00003
NEXT
? TRANSFORM(v)
? TRANSFORM(v,'@^')
? v=3
? v=3.00000000000
* OK v is 3.
* No! v isn't 3.
? v=3.000000000000
? TRANSFORM(v+0.000000000000000)
? (v-3)*10^15


CREATE CURSOR TEST (v B)
APPEND BLANK
FOR I=1 TO 100
 REPLACE v WITH Round(v+0.03,4)
NEXT
? TRANSFORM(v)
? TRANSFORM(v,'@^')
? v=3
? v=3.00000000000
* OK v is 3.
* No! v isn't 3.
? v=3.000000000000
? TRANSFORM(v+0.000000000000000)
? (v-3)*10^15
I think what you showed wasn't a prolem of VFP but IEEE 754 specification.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform