This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Improves __ieee754_exp() performance by greater than 5x on sparc/x86.
On Thu, 26 Oct 2017, Patrick McGehearty wrote:
> On 10/26/2017 12:25 PM, Joseph Myers wrote:
> > On Thu, 26 Oct 2017, Joseph Myers wrote:
> >
> > > Unless a particular constant, table etc. is needed in the code both as
> > > integers and as double, just define it as double and initialize with a C99
> > > hex float constant, without involving unions at all. This certainly
> > > applies to some of your constants, possibly all of them.
> > To be clear: all my past and present comments about hex floats always mean
> > C99 0x1.2p3 and similar constants. Never hex integer values with a union
> > as in this patch. You should never, anywhere in glibc, have any occasion
> > to initialize a floating-point constant via specifying the integer values
> > of its representation (except in testcases for special ldbl-96 and
> > ldbl-128ibm representations). Proper hex floating-point constants are
> > always better.
> >
> I was following the hex pattern used in sysdeps/ieee754/dbl-64/uexp.tbl
That's an obsolescent pattern, not to be used in new code; it just so
happens that file hasn't yet been cleaned up to define double constants
directly with C99 hex floats.
> To be sure I'm understanding your comment correctly, you are
> recommending I change from the union form of the hex constants
> to 0x1.23p3 form of the constants and resubmit the patch.
Yes. For anything intending a particular, pre-computed floating-point
value to be used, represent that value as a C99 hex float constant as the
preferred way in new code of making the intended constant unambiguous.
--
Joseph S. Myers
joseph@codesourcery.com