Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2006-10-31 12:17:07


On 10/30/06 5:50 AM, "Paul A Bristow" <pbristow_at_[hidden]> wrote:

>> -----Original Message-----
>> From: boost-bounces_at_[hidden]
>> [mailto:boost-bounces_at_[hidden]] On Behalf Of Daryle Walker
>> Sent: 29 October 2006 20:00
>> To: Boost mailing list
>> Subject: [boost] Simulating log{10}(2)
> <snip>
>
>> The common approximation 0.301 differs from the actual expansion at a4 = 2.
>> The convergent there is 59/196. The absolute differences between those
>> values and the actual value are:
>>
>> |log{10}(2) - 0.301| = 2.9995664e-5
>> |log{10}(2) - 59/196| = 9.58750072e-6
>>
>> The convergent is 3.1 times closer to the actual value than the common
>> approximation. Using 0.30103 versus the convergent 4004/13301 at the point
>> of differing a7 = 6 gives the convergent an improvement factor of 2.1. The
>> convergents have smaller numerators and denominators than their common
>> approximations, making them easier to calculate without worry of overflow.
>> Conversely, if you know that you have more leeway in multiplications, then
>> using higher convergent fractions instead of the decimal expansion are a
>> better bet.
>
> Well this is very interesting and I am sure you are right, but for the
> purpose of calculating the number of decimal digits, the approximation seems
> to me to be 'fit for purpose' (or good enough).
[TRUNCATE how the current approximations are used]

But we have the option of doing better. I'm wondering if we should change
our code to use the better approximating fractions.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk