Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating very large numbers
Message
De
09/09/2009 09:05:22
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
09/09/2009 04:19:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01423218
Message ID:
01423243
Vues:
118
This message has been marked as the solution to the initial question of the thread.
>Dear All
>
>Is there any way to make precise calculation without number being rounded
>
>? 22919090710007290*100/97
>
>Returns rounded number. I need actual remainder.
>Mod(22919090710007290*100,97) returns 0
>
>What are the options.
>
>TIA
>Sergio

Visual FoxPro's built-in calculations use a fixed number of significant digits - about 15 or 16. Even when you are only approaching that limit, there may be rounding errors, due to the conversion between decimal and binary - since the computer internally does calculations in binary..

You can do calculations on strings of numbers, one digit at a time, using the well-known algorithms of addition, subtraction, etc., but the result would be much slower. In any case, it is thus possible to have arbitrary precision.

See my download #10044, which does all that.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform