Re: Fix ilogb(3)

2020-11-07 Thread Philip Guenther
On Fri, Nov 6, 2020 at 4:51 PM George Koehler  wrote:

> Your ilogb fix is ok gkoehler@
>

It's annoying that C and/or ieee754 and the original hardware
implementation in the x87 instructions diverged in their definitions, but
the former is what matters and libm needs to follow that.  ok guenther@



> On Sat, 31 Oct 2020 16:09:07 +0100 (CET)
> Mark Kettenis  wrote:
>
> > - Dropping the amd64 and i386 versions.  Fixing the corner cases in
> >   assembly is hard, and the C implementation should be fast enough for
> >   regular floating-point values.
>
> The amd64 and i386 assembly uses the x87 fxtract instruction.  I feel
> that x87 instructions are obsolete on amd64.  <...>


Umm, no?  The amd64 ABI defines "long double" as matching the format used
by the x87 instructions; a function returning that type returns it in the
x87 %st(0) register and a review of libm finds many of the functions are
naturally implemented by the native x87 instructions.

I believe the main issue in this case is that the standard evolved away
from what Kahan originally did as a consultant with Intel.  For a note on
how the ieee754 standard originated in (large) part from what Kahan did
with Intel, see
  https://people.eecs.berkeley.edu/~wkahan/ieee754status/754story.html

I'm not nearly enough of a numerical analyst to judge the decision of the
standard.


Philip Guenther


Re: Fix ilogb(3)

2020-11-06 Thread George Koehler
Your ilogb fix is ok gkoehler@

On Sat, 31 Oct 2020 16:09:07 +0100 (CET)
Mark Kettenis  wrote:

> - Dropping the amd64 and i386 versions.  Fixing the corner cases in
>   assembly is hard, and the C implementation should be fast enough for
>   regular floating-point values.

The amd64 and i386 assembly uses the x87 fxtract instruction.  I feel
that x87 instructions are obsolete on amd64.  One might want to use
fxtract on i386, but software might call frexp(3) to get the exponent,
and we have frexp(3) in C.  I am ok with ilogb(3) in C.



Re: Fix ilogb(3)

2020-11-02 Thread j

...snip...


Here is a diff that fixes those issues by:


...snip...


The code reads OK.  Needs the manpage update to refer to FP_ILOGB0 not 
INT_MIN.



John