Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2012 23:05:19 -0000
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Diane Bruce <db@db.net>, John Baldwin <jhb@freebsd.org>, David Chisnall <theraven@freebsd.org>, Stephen Montgomery-Smith <stephen@missouri.edu>, Bruce Evans <bde@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, David Schultz <das@freebsd.org>, Peter Jeremy <peter@rulingia.com>
Subject:   Re: Use of C99 extra long double math functions after r236148
Message-ID:  <20120717042434.GA87001@troutmask.apl.washington.edu>
Resent-Message-ID: <20120812230511.GS20453@server.rulingia.com>
In-Reply-To: <6F750F84-34FF-4961-A2EA-F3E67A6872AE@bsdimp.com>
References:  <201207130818.38535.jhb@freebsd.org> <9EB2DA4F-19D7-4BA5-8811-D9451CB1D907@theravensnest.org> <C527B388-3537-406F-BA6D-2FA45B9EAA3B@FreeBSD.org> <20120713155805.GC81965@zim.MIT.EDU> <20120714120432.GA70706@server.rulingia.com> <20120717084457.U3890@besplex.bde.org> <5004A5C7.1040405@missouri.edu> <5004DEA9.1050001@missouri.edu> <20120717040118.GA86840@troutmask.apl.washington.edu> <6F750F84-34FF-4961-A2EA-F3E67A6872AE@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 16, 2012 at 10:12:21PM -0600, Warner Losh wrote:
> 
> On Jul 16, 2012, at 10:01 PM, Steve Kargl wrote:
> 
> > 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.
> 
> Yes.  Pseudo code is OK for following the flow, but look at the
> exp code for why that's not entirely sufficient.  You have to be
> extremely fussy about all kinds of things.  Then again, exp is a
> lot more important to get right than the complex trig functions...
> 
> The pseudo code is a good place to start, but it just the barest
> start in the integration process...

I can't tell whether you agree with my urging of caution or whether
your being sarcastic.  The pseudo-code as written simply does not
apply once one looks at n1256.pdf.

-- 
Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120717042434.GA87001>