Re: Strange expl results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-11-29 19:14:37 +0300, Alex Markin via Gcc-help wrote:
> The problem starts when you have a cross-platform project where on
> the second platform we have a non-gcc compiler and 80-bit float
> calculations on non-intel hardware. That is my case where on the
> second platform expl calculates in the right way and after a
> sequence of evaluations we get a big error accumulation and the
> program behaviour becomes different.

This is not specific to the 80-bit extended precision. Any FP format
may be affected. When the argument is known at compile time, GCC can
optimize and it normally uses GNU MPFR to compute the result with
correct rounding (which is the best possible result and the only
good way to specify the result completely). This means that if the
library does not provide correct rounding, you will get differences
with results computed at compile time (and differences with other
libraries, possibly across different versions of the same library).
You can see a summary of differences between libraries for the
double type (double precision, or binary64) and various functions:

  https://www.vinc17.net/research/testlibm/

These are tests on values that are difficult to round due to the
"Table maker's dilemma". As you can see, for a long time, glibc
was implementing correct rounding for exp and log in particular
(my tests started with glibc 2.2.5, on spe170 in the table), thus
with no differences compared to the compile-time result with GCC
(using MPFR); but this is no longer the case (e.g. with glibc 2.28,
on joooj in the table). This changed in 2018:

commit de800d83059dbedb7d151580f0a3bdc9eaf37340
Author: Szabolcs Nagy <szabolcs.nagy@xxxxxxx>
Date:   2018-01-30 15:48:22 +0100

    Remove slow paths from exp

commit b7c83ca30ef8e85b6642151d95600a36535f8d97
Author: Wilco Dijkstra <wdijkstr@xxxxxxx>
Date:   2018-02-07 13:24:43 +0100

    Remove slow paths from log

(BTW, reducing the precision of the slow path may have been a better
compromise, with no differences on the results, at least on exp and
log, as I say in the slides mentioned below.)

On https://www.vinc17.net/research/slides/sieste2010.pdf slides 11 to 17
you can see various differences obtained with GCC involving a same
expression.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux