This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improves __ieee754_exp() performance by greater than 5x on sparc/x86.


On 10/20/2017 6:41 AM, Szabolcs Nagy wrote:
On 19/10/17 23:31, Patrick McGehearty wrote:
Table of hex float constants. I can readily adjust the formating. What
you see is the formating used in the original source.
I've been uncomfortable with hex floats approach
as it only works for ieee754 representations
that use base 2. I admit that is most current machines.
your entire algorithm depends on ieee754 binary representation,
that's not a good reason for avoiding hexfloats.

decimal floats are not even required to be correctly rounded by
the compiler in iso c, they are only faithfully rounded, so
this is a portability bug in the original source too, you can
silently get completely wrong code generation because of it.

And the prior ieee754 exp table uses hex format.
My second reason for resisting the change is my philosophy
when porting code is that every change without a good reason
is an opportunity to introduce errors without corresponding benefit.

If you feel strongly about suing hex constants, I will make an effort
to convert these values to hex format.  This conversion seems likely
to require the most effort on my part.

You make good points. In the prior context of the code being built
and used for Sparc/Solaris, the Studio compiler was known to
correctly round floating point constants since the early 90's.
In the gnu context, we have to be prepared for any C standard
compliant compiler, which is a greater challenge.
I'll make the conversion to using hex constants. I'm wondering
if it would be beneficial to retain the decimal constants in comment form?
Maybe not for the big table, but for the constants used for
specific thresholds, etc.  I know when I first looked at
some of this code, I wrote a little program to display the
decimal equivalents of some of the hex constants to better understand
what the control flow was doing.

- patrick




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]