Re: Use of C99 extra long double math functions after r236148

From: Peter Jeremy <peter_at_rulingia.com>
Date: Wed, 11 Jul 2012 10:55:06 +1000
On 2012-Jul-08 19:01:07 -0700, Steve Kargl <sgk_at_troutmask.apl.washington.edu> wrote:
>Well, on the most popular hardware (that being i386/amd64),
>ld80 will use hardware fp instruction while ld128 must be
>done completely in software.  The speed difference is
>significant.

AFAIK, of the architectures that FreeBSD supports, only sparc64
defines ld128 in the architecture and I don't believe there are any
SPARC chip implementations that implement ld128 math in hardware.

For that matter, I don't believe anything except x86 provides full
IEEE FP support in hardware - most architectures require software
assistance for subnormals and some corner cases.  If your application
happens to hit those cases often, performance will also suffer.

On 2012-Jul-08 20:05:04 -0700, Steve Kargl <sgk_at_troutmask.apl.washington.edu> wrote:
>AFAIK, neither gcc in base nor clang would be c99 complaint
>even if all of the c99 math functions were available.

That sort of argument can easily get circular.  Lets get the C99 bits
of libm out of the way and then we can have another bikeshed about the
shortcomings of the compiler(s).

On 2012-Jul-08 19:56:52 -0400, David Schultz <das_at_FreeBSD.ORG> wrote:
>Yes, Bruce has ld128 versions, and clusteradm very kindly got us a
>sparc64 machine to test on.  That was about the time I ran out of time
>to keep working on it.  If someone wants to pick it up, that would be
>great.

I have access to a couple of SPARC systems as well and would be willing
to help work on the missing bits.

On 2012-Jul-10 18:58:01 -0400, David Schultz <das_at_FreeBSD.ORG> wrote:
>On Tue, Jul 10, 2012, Rainer Hurling wrote:
>> powl:   src/extra/trio/triostr.c
>>         src/extra/trio/trio.c
>>         src/main/format.c
>
>It's hard to do a good job on powl(), but the simple approach
>(exp(log(x)*y)) plus a few special cases may suffice for many uses.

A simplistic exp(log(x)*y) throws away 15 bits of precision (size of
the FP exponent field).  cephes has a powl() that appears to do better
or, alternatively, it shouldn't be too difficult to extend the approach
used by __ieee754_pow() using long doubles.

>> BTW: There seems to be a discrepancy about missing functions listed in
>> http://wiki.freebsd.org/MissingMathStuff and in
>> http://svnweb.freebsd.org/base/head/lib/msun/src/math.h?r1=227472&r2=236148&pathrev=236148.
>> So the wiki is a bit outdated now?
>My list:
[elided]

I was thinking that a wiki page would be a good spot to co-ordinate
the work (as well as making it clear what is still to be done).  The
existing page needs some TLC to be useful.

-- 
Peter Jeremy

Received on Tue Jul 10 2012 - 22:55:16 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:28 UTC