From owner-freebsd-current@FreeBSD.ORG Tue May 29 00:07:56 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AB1B5106566B for ; Tue, 29 May 2012 00:07:56 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 63DAF8FC0C for ; Tue, 29 May 2012 00:07:56 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q4T07uNJ077440; Mon, 28 May 2012 17:07:56 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q4T07uS8077439; Mon, 28 May 2012 17:07:56 -0700 (PDT) (envelope-from sgk) Date: Mon, 28 May 2012 17:07:56 -0700 From: Steve Kargl To: Stephen Montgomery-Smith Message-ID: <20120529000756.GA77386@troutmask.apl.washington.edu> References: <4FC36FE1.9080908@gwdg.de> <4FC38B81.6000302@gwdg.de> <4FC3A154.8030702@missouri.edu> <20120528203159.GA76340@troutmask.apl.washington.edu> <4FC3EBDA.2080502@missouri.edu> <20120528221731.GA76723@troutmask.apl.washington.edu> <4FC40449.3040602@missouri.edu> <20120528233035.GA77157@troutmask.apl.washington.edu> <4FC40DEA.8030703@missouri.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FC40DEA.8030703@missouri.edu> User-Agent: Mutt/1.4.2.3i Cc: freebsd-current@freebsd.org Subject: Re: Use of C99 extra long double math functions after r236148 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2012 00:07:56 -0000 On Mon, May 28, 2012 at 06:44:42PM -0500, Stephen Montgomery-Smith wrote: > On 05/28/2012 06:30 PM, Steve Kargl wrote: > > > > >>From clog.c in http://www.netlib.org/cephes/c9x-complex > > > >double complex > >ccosh (z) > > double complex z; > >{ > > double complex w; > > double x, y; > > > > x = creal(z); > > y = cimag(z); > > w = cosh (x) * cos (y) + (sinh (x) * sin (y)) * I; > > return (w); > >} > > > >See math_private.h about the above. > > > > I looked in math_private.h - I presume you meant > lib/msun/src/math_private.h. I wasn't able to find anything about ccosh > there. > > I think that for a rough and ready ccosh, this is high enough quality > for a math/cephes port. That's the problem. It is not acceptable (imo). The comment in math_private.h that is relevant is /* * Inline functions that can be used to construct complex values. * * The C99 standard intends x+I*y to be used for this, but x+I*y is * currently unusable in general since gcc introduces many overflow, * underflow, sign and efficiency bugs by rewriting I*y as * (0.0+I)*(y+0.0*I) and laboriously computing the full complex product. * In particular, I*Inf is corrupted to NaN+I*Inf, and I*-0 is corrupted * to -0.0+I*0.0. */ Those wrong +-0 mean you may up end up on the worng riemann sheet, and that NaN propagates. -- Steve