Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding and Subtracting large numbers
Message
De
25/09/2019 12:16:06
 
 
À
25/09/2019 11:59:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01671113
Message ID:
01671121
Vues:
53
>Ahem, are you certain vfp currency is not up to the job ? IIRC it is an 8-byte signend integer with an "arbitrary" set decimal point resulting in 4 decimals. So if you are certain you will not have any decimals, you can eliminate or "shift" the 4 decimals. And if it is only for hash codes, where probably the only questions asked are == and !=, why not implement in C and just save the result, either as 2 integers or currency or in this case my favorite varchar binary ? Last one can grow above 8 byte length if the collision area needs to be reduced by enlarging hash result abd function....
>
>curious
>
>thomas

Currency is stored in VFP as a 64-bit integer with 4-implied decimals. It holds 18-19 decimals of precision. There's a warning in the VFP Help under System Capacities that it can compute a maximum of 15-16 significant digits of accuracy, as it uses an internal 64-bit floating point value to carry out calculations.

The bignum.vcx class could be extended to create a bigint subset, allowing for arbitrary precision integers. GMP is good for that, and the same code could wrap around it for the integer portion.

See attached for the bignum C/C++ source code (not including the bigint subset).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform