From: Hubert Holin (Hubert.Holin_at_[hidden])
Date: 2005-04-05 09:24:13
Somewhere in the E.U., le 05/04/2005
In article <007601c537a0$696a8210$51eb1b52_at_fuji>,
"John Maddock" <john_at_[hidden]> wrote:
> As part of the project to produce a Boost TR1 implementation I've
> implemented the additional algorithms in <complex> that are part of the TR:
> asin asinh
> acos acosh
> atan atanh
> It occurs to me that maybe these should really be spun out as a separate
> library rather than "slipped in" as part of another submission (comments
> welcome on that).
FWIW, asinh, acosh and atanh are already in Boost! If you wish, I
can retire them (though I planed to add valarray support, I even printed
a few days ago the discussion which had taken place on this two years
> In the mean time these algorithms can be downloaded as part of the TR1
> library here:
(not showing up yet...)
> All the inverse trig functions are defined for the full complex plain, and
> do the right thing even for exceptional input (no overflow or underflow
> during the computation if the result is actually representable). They also
> do the right thing for infinities and nan's, as specified by C99.
> The asin/asinh/acos/acosh algorithms have a theoretical max error bound of
> 9.5e (experimental bounds are much lower, about 4e), there is no theoretical
> work on atan/atanh that I know of, but experimentally the error bound seems
> lower than for asin/acos. This is some of the most heavily commented code
> I've written, so refer to the header for more information on the literature
> sources used etc.
> During the implementation I found that I needed a few other things that
> might make useful Boost components (part implemented, part wish list as
> noted below):
> 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.
> Series Summation (Kahan Method):
> I wrote a small routine to apply the Kahan summation method to a
> nullary-functor that generates successive terms in a series. Summation
> stops when the next term is below a particular threshold. I've found the
> Kahan method to be significantly more accurate for certain series, but again
> some highly optimizing compilers can cause small errors to creep in (I
> believe that the issue is double-rounding of intermediate terms on machines
> with extended-double registers). Probably my current interface to this one
> needs some more thought before it could be anything other than a detail, and
> if we're talking about wish lists, infinite product, and continued fraction
> evaluation would be useful additions too....
> Floating point testing:
> Currently just a version of C99's isnan, and only works for quiet nan's with
> IEEE-conforming compilers. More of a wish list really, I could really use
> all the C99 fp-testing macros (as C++ functions obviously).
> Numeric constants:
> Currently I've embedded the numeric constants used inside the
> implementation, a numeric constants library really would have simplified
> things... just a pity we could never agree on an interface last time this
> came up.
> Whew, I think that's all, thanks for reading this far!
Thanks for the work! I'll look into details when they show up.