Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
16 digit precision limit
Message
De
27/02/2002 07:18:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00625633
Message ID:
00625635
Vues:
9
>I need to calculate and store in a table some factorial numbers (n!) for n<=30.
>For elaboration performance I have to create a "factorial matrix".
>I made it using double fields. All work ok,for little number, but the value that is effectively stored and pheraps calculated isn't correct (exact) when they are expressed as exponential. Documentation says that double field precision is (+/-4.94065645841247E-324 to +/-8.9884656743115E307)
>30!= in my table is something like 2,6525285981219+E32 but I think that this value don't have enought decimail digits and of course isn't exact.
>If I'm not in wrong,how can I operate whit more decimal digits precision.
>
>Thanks in advance
>Enrico De Angelis

1) 15-16 significant digits, yes. No exact (integer) figure can be given, because data is stored internally as binary, not decimal.

2) I created a class that does math with almost unlimited precision. The class includes methods add(), subtract(), multiply(), divide(), exp(), sin(), greater(), less(), equal(), pi_access(), and several others more. I think I even included a factorial() method.

Since several people seem to be interested in "unlimited precision", I will post it soon on the UT.

In the meantime, if you need it urgently, send me an e-mail, and I will send you the class.

Please note that this sort of calculations are relatively slow in VFP.

Hilmar.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform