From owner-freebsd-numerics@FreeBSD.ORG Sun Aug 12 23:08:37 2012 Return-Path: Delivered-To: freebsd-numerics@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A0FA106566B for ; Sun, 12 Aug 2012 23:08:37 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by mx1.freebsd.org (Postfix) with ESMTP id C7CA28FC18 for ; Sun, 12 Aug 2012 23:08:36 +0000 (UTC) Received: from server.rulingia.com (c220-239-249-137.belrs5.nsw.optusnet.com.au [220.239.249.137]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id q7CN8awn075747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 13 Aug 2012 09:08:36 +1000 (EST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.5/8.14.5) with ESMTP id q7CN8U3X021450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 13 Aug 2012 09:08:30 +1000 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id q7CN8UE1021449 for freebsd-numerics@freebsd.org; Mon, 13 Aug 2012 09:08:30 +1000 (EST) (envelope-from peter) Resent-From: Peter Jeremy Resent-Date: Mon, 13 Aug 2012 09:08:30 +1000 Resent-Message-ID: <20120812230830.GF20453@server.rulingia.com> Resent-To: freebsd-numerics@freebsd.org Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by server.rulingia.com (8.14.5/8.14.5) with ESMTP id q6J325Y8008702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Jul 2012 13:02:05 +1000 (EST) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id q6J323Xc079080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 19 Jul 2012 13:02:05 +1000 (EST) (envelope-from sgk@troutmask.apl.washington.edu) 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 q6J322bt001454; Wed, 18 Jul 2012 20:02:02 -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 q6J321bn001453; Wed, 18 Jul 2012 20:02:01 -0700 (PDT) (envelope-from sgk) From: Steve Kargl Mail-Followup-To: freebsd-numerics@freebsd.org To: Peter Jeremy Message-ID: <20120719030201.GB1376@troutmask.apl.washington.edu> References: <20120713155805.GC81965@zim.MIT.EDU> <20120714120432.GA70706@server.rulingia.com> <20120717084457.U3890@besplex.bde.org> <5004A5C7.1040405@missouri.edu> <5004DEA9.1050001@missouri.edu> <20120717200931.U6624@besplex.bde.org> <5006D13D.2080702@missouri.edu> <20120718205625.GA409@troutmask.apl.washington.edu> <500725F2.7060603@missouri.edu> <20120718224222.GA6022@server.rulingia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120718224222.GA6022@server.rulingia.com> User-Agent: Mutt/1.4.2.3i Cc: Diane Bruce , John Baldwin , David Chisnall , Stephen Montgomery-Smith , Bruce Evans , Bruce Evans , David Schultz , Warner Losh Subject: Re: Use of C99 extra long double math functions after r236148 X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of high quality implementation of libm functions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Sun, 12 Aug 2012 23:08:37 -0000 X-Original-Date: Wed, 18 Jul 2012 20:02:01 -0700 X-List-Received-Date: Sun, 12 Aug 2012 23:08:37 -0000 On Thu, Jul 19, 2012 at 08:42:22AM +1000, Peter Jeremy wrote: > On 2012-Jul-18 10:07:41 -0500, Stephen Montgomery-Smith wrote: > >I went on a long road trip yesterday, so I didn't get any code written, > >but I did have a lot of thoughts about clog and casinh. > > Can I suggest you have a read through "Implementing the Complex > Arcsine and Arccosine Functions Using Exception Handling" by > T. E. Hull Thomas F. Fairgrieve and Ping Tak Peter Tang, ACM > Transactions on Mathematical Software, Vol. 23, No. 3, September 1997. > Based on a quick skim, it includes fairly detailed pseudocode, > together with an error analysis. It's always good to searh the literature. > > On 2012-Jul-18 16:09:06 -0500, Stephen Montgomery-Smith wrote: > >Am I to understand that the inexact flag should be set anytime a > >floating point operation produces an answer that is not guaranteed > >exact? > > My understanding is, yes. For the transcendental functions, that > means the inexact flag should almost always be raised and the problem > becomes when not to raise it. Eg sin(0) == 0 and presumably doesn't > set the inexact flag. > > > For example, should 1.0/3.0 and sqrt(2.0) raise the inexact flag? > > Yes and yes. I notice our sqrtl() actually tests the inexact flag of > an intermediate calculation to determine the correct rounding for the > result. sqrt() is special in that IEEE 754 requires that it return a correctly rounded result in all rounding modes. See src/e_asin.c where one cause an inexact to occur. You'll find code fragments like if(ix<0x3e500000) { /* if |x| < 2**-26 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ } huge+x causes the inexact flag to be raised and the condition is always true. > I've also found that Abramowitz and Stegun "Handbook of Mathematical > Functions", 10th printing, is available online at > http://people.maths.ox.ac.uk/~macdonald/aands/index.html > and various mirrors. I'm still looking for a copy of Cody & Waite. NIST recently revised A&S. You can get to online at http://dlmf.nist.gov/ -- Steve