Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Numeric digits of precision
Message
De
06/03/2002 06:23:27
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00626806
Message ID:
00628880
Vues:
13
>David,
>
>>Floating point numbers are rarely ever "accurate" especially when you
>>bring functions like log() into the mix, because the constants used
>>in the calculation can't be expressed in 32, 64 or even an infinite
>>number of bits.
>
>I understand about lack of precision when it comes to LOG(). I don't understand lack of precision when it comes to 2^2.

As David says, the slight innacuracy is due to the fact that I calculate powers using exp() and log(). This allows me to calculate powers, not only with integral exponents, for instance, 2^0.5 (= sqrt(2)). Just look at the source code to see what I mean.

I already created, and will eventually post, a second version of the power method, .PowerInt(), based on repetitive multiplication. This will solve the slight innacuracy. Also, it should work faster when the exponent is not too big.

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