|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2005-04-06 05:07:57
>> log1p:
>> ~~~~
>>
>> This algorithm is part of C99, but by no means all compilers support it
>> yet,
>> I used a Taylor series expansion for small x: I'm aware that there are
>> much
>> more efficient methods, but optimizing compilers completely trash the
>> logic
>> of these (Intel C++ proved to be particularly bad).
>
> I had planed to work on it (and a few related such as expm1...)
> something liketwo years ago and had planed to add it to the same special
> functions library. They really are important.
Agreed: how were you planning to implement expm1? The obvious series
expansion:
expm1(z) = SUM[k=1, INF] (z^k / k!)
would converge in less than B steps for a B bit floating point type and |z|
< 0.5 (in other words reasonable but not astounding performance), in fact it
would be trivial to plug that into my existing series summation code.
Alternatively there's a table based method
(http://portal.acm.org/citation.cfm?doid=146847.146928) which claims to be
particularly accurate.
Any others? You've got my curiosity roused...
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk