Date: Sun, 12 Aug 2012 23:08:55 -0000 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: Stephen Montgomery-Smith <stephen@missouri.edu> Cc: Diane Bruce <db@db.net>, John Baldwin <jhb@freebsd.org>, David Chisnall <theraven@freebsd.org>, Bruce Evans <bde@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, David Schultz <das@freebsd.org>, Peter Jeremy <peter@rulingia.com>, Warner Losh <imp@bsdimp.com> Subject: Re: Use of C99 extra long double math functions after r236148 Message-ID: <20120719032706.GA1558@troutmask.apl.washington.edu> Resent-Message-ID: <20120812230848.GI20453@server.rulingia.com> In-Reply-To: <50077987.1080307@missouri.edu> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <fenv.h> > > 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); -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120719032706.GA1558>