This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Math functions and rounding mode
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: "patrick dot mcgehearty at oracle dot com" <patrick dot mcgehearty at oracle dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Mon, 1 Jan 2018 16:35:31 +0000
- Subject: Re: Math functions and rounding mode
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco dot Dijkstra at arm dot com;
- Nodisclaimer: True
- References: <DB6PR0801MB2053D73D0DCF65F8E6CC4AD483180@DB6PR0801MB2053.eurprd08.prod.outlook.com>,<alpine.DEB.2.20.1801011445380.394@digraph.polyomino.org.uk>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Joseph Myers wrote:
> On Mon, 1 Jan 2018, Wilco Dijkstra wrote:
>
>> I think we're using the wrong approach here. Assuming exp has acceptable ULP
>> errors in all rounding modes (we allow a larger ULP in non-nearest modes),
>> we never need to change rounding mode in exp itself. If functions like tgamma
>> or cexp end up with errors or unacceptable ULP in non-nearest rounding modes,
>> we should simply wrap *those* functions with SET_RESTORE_ROUND.
>
> tgamma already does use SET_RESTORE_ROUND to reduce error accumulation
> (and then has code to correct overflowing / underflowing results to be
> appropriate for the actual rounding mode).
That's great, so the principle already exists. So my suggestion would be to rip out
all the SET_RESTORE_ROUND from exp and see what ULP errors we get for cexp
and others. If unacceptable in non-nearest rounding modes we should just add a
SET_RESTORE_ROUND to those functions and be done with it for this release.
Wilco