From: Szabolcs Nagy <nsz@port70.net>
To: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Cc: dalias@libc.org, musl@lists.openwall.com
Subject: Re: [musl] Re: integration of CORE-MATH routines into Musl?
Date: Mon, 5 Sep 2022 18:38:30 +0200 [thread overview]
Message-ID: <20220905163830.GP1320090@port70.net> (raw)
In-Reply-To: <mwzgfdansp.fsf@tomate.loria.fr>
* Paul Zimmermann <Paul.Zimmermann@inria.fr> [2022-09-05 16:39:02 +0200]:
> Dear Szabolcs,
>
> > when i worked on exp and log i noticed that for single prec it is
> > easy to do correct rounding with only minor overhead, but it required
> > either a bit bigger lookup table or a bit bigger polynomial vs going
> > for < 1 ulp error only.
>
> please have a look at https://gitlab.inria.fr/core-math/core-math/-/blob/master/src/binary32/exp/expf.c: no big lookup table, degree 5 only.
"a bit bigger".
in this case the polynomial is bigger: order 5 instead of 3.
(order 3 is enough for < 1 ulp error).
the code size is also bigger:
core-math: size -G (x86_64 -O3):
text data bss total filename
464 352 0 816 exp2/exp2f.o
398 348 0 746 exp/expf.o
musl: size -G: (data is shared between expf, exp2f and powf)
text data bss total filename
0 328 0 328 exp2f_data.o
202 12 0 214 exp2f.o
211 16 0 227 expf.o
i'd expect at least a bit of overhead between <1 ulp and cr functions
(but not significant overhead in case of binary32). so when core-math
is faster, it should be possible to write an even faster version that
only aims to be <1 ulp (but the perf diff will not be huge).
in case of binary64: i'd expect one can turn a close to 0.5 ulp
implementation into a cr one with small overhead by testing for near
halfway cases in the end and having a slow path for those. but the
slow path will be much slower and bigger (and harder to test).
next prev parent reply other threads:[~2022-09-05 16:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mwv8q6ccj9.fsf@tomate.loria.fr>
2022-09-02 12:17 ` Rich Felker
2022-09-02 19:28 ` enh
2022-09-02 20:40 ` enh
2022-09-05 9:09 ` Paul Zimmermann
2022-09-05 13:08 ` Szabolcs Nagy
2022-09-05 14:39 ` Paul Zimmermann
2022-09-05 16:38 ` Szabolcs Nagy [this message]
2022-09-06 23:40 ` enh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220905163830.GP1320090@port70.net \
--to=nsz@port70.net \
--cc=Paul.Zimmermann@inria.fr \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).