From owner-freebsd-numerics@FreeBSD.ORG Sun Aug 12 23:09:02 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 880FC1065678 for ; Sun, 12 Aug 2012 23:09:02 +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 E76978FC14 for ; Sun, 12 Aug 2012 23:09:01 +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 q7CN911H075767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 13 Aug 2012 09:09:01 +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 q7CN8tFm021494 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 13 Aug 2012 09:08:55 +1000 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id q7CN8tGT021493 for freebsd-numerics@freebsd.org; Mon, 13 Aug 2012 09:08:55 +1000 (EST) (envelope-from peter) Resent-From: Peter Jeremy Resent-Date: Mon, 13 Aug 2012 09:08:55 +1000 Resent-Message-ID: <20120812230855.GJ20453@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 q6J3i5Fn009349 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Jul 2012 13:44:05 +1000 (EST) (envelope-from stephen@missouri.edu) Received: from wilberforce.math.missouri.edu (wilberforce.math.missouri.edu [128.206.184.213]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id q6J3i2O1079163 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 19 Jul 2012 13:44:04 +1000 (EST) (envelope-from stephen@missouri.edu) Received: from [127.0.0.1] (wilberforce.math.missouri.edu [128.206.184.213]) by wilberforce.math.missouri.edu (8.14.5/8.14.5) with ESMTP id q6J3hfng079974; Wed, 18 Jul 2012 22:43:42 -0500 (CDT) (envelope-from stephen@missouri.edu) Message-ID: <5007826D.7060806@missouri.edu> From: Stephen Montgomery-Smith Mail-Followup-To: freebsd-numerics@freebsd.org User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Steve Kargl References: <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> <20120719025345.GA1376@troutmask.apl.washington.edu> <50077987.1080307@missouri.edu> <20120719032706.GA1558@troutmask.apl.washington.edu> In-Reply-To: <20120719032706.GA1558@troutmask.apl.washington.edu> Content-Type: multipart/mixed; boundary="------------010702080409040707040105" X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Diane Bruce , John Baldwin , David Chisnall , Bruce Evans , Bruce Evans , David Schultz , Peter Jeremy , 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:09:02 -0000 X-Original-Date: Wed, 18 Jul 2012 22:43:41 -0500 X-List-Received-Date: Sun, 12 Aug 2012 23:09:02 -0000 This is a multi-part message in MIME format. --------------010702080409040707040105 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 07/18/2012 10:27 PM, Steve Kargl wrote: > On Wed, Jul 18, 2012 at 10:05:43PM -0500, Stephen Montgomery-Smith wrote: >> On 07/18/2012 09:53 PM, Steve Kargl wrote: >>> >>> The inexact flag will get raised by the fpu, but you need to >>> cause the condition. For your 'sqrt(y*y-1) = y' example, >>> you would do something like 'sqrt(y*y-1) = abs(y) - tiny' where >>> tiny is much less than abs(y). Search msun/src for inexact >>> (ie., grep -i inexact msun/src/*.c) >>> >> >> Couldn't you do this instead? >> >> #include >> >> feraiseexcept(FE_INEXACT) >> > > I haven't checked, but I suspect you're looking at a speed > issue. It's faster to let the hardware raise the flag. > It seems that libm only uses the above in the fuse-multiple-add > code: > > laptop:kargl[206] grep feraise src/*c > src/s_fma.c: feraiseexcept(FE_INEXACT); > src/s_fma.c: feraiseexcept(FE_UNDERFLOW); > src/s_fmal.c: feraiseexcept(FE_INEXACT); > src/s_fmal.c: feraiseexcept(FE_UNDERFLOW); > src/s_lround.c: feraiseexcept(FE_INVALID); > Still, I think I will use the feraiseexcept function in clog, because speed isn't an issue when nans are involved. And it does make the code less obscure. --------------010702080409040707040105--