Use of C99 extra long double math functions after r236148

Steve Kargl sgk at troutmask.apl.washington.edu
Sun Aug 12 22:37:22 UTC 2012


On Mon, Jul 16, 2012 at 10:40:25PM -0500, Stephen Montgomery-Smith wrote:
> 
> I came up with pseudo code that looks a bit like this.
> 
> complex casinh(complex z) {
>   double x = z.re, y = z.im;
> 
>   if (y==0)
>     return asinh(x);
>   if (x==0) {
>     if (fabs(y)<=1) return I*asin(y);
>     else return signum(y)* (
>       log(fabs(y)+sqrt(y*y-1))
>       + I*PI/2);

Stop.  Please see msun/src/math_private.h. You cannot
use I in any expression.  gcc in base and clang do not
do the arithmetic correctly.  See msun/src/s_ccosh.c
for how one might approach writing these functions.
Also, consult n1256.pdf for x,y = +-0, +-inf, nan. 
There are specific requirements that must be met.

-- 
Steve


More information about the freebsd-numerics mailing list