Strange expl results

Alex Markin alexanius@gmail.com
Sun Nov 29 16:14:37 GMT 2020


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.

To my pity I can not find an example on any widespread platform to show the
different
behaviour of expl, so that seems to stay here for a long time.

пт, 27 нояб. 2020 г. в 10:54, Stefan Ring <stefanrin@gmail.com>:

> On Thu, Nov 26, 2020 at 11:46 PM Stefan Ring <stefanrin@gmail.com> wrote:
> >
> > On Thu, Nov 26, 2020 at 11:27 PM Alex Markin <alexanius@gmail.com>
> wrote:
> > >
> > > memset will not help here.
> >
> > True, but only because it is optimized away! :D
>
> With -O2, the compiler pre-computes both of them at compile time, and
> they are both the same (but the upper 6 bytes stay uninitialized, even
> with memset).
>
> With -O0, the compiler pre-computes the first one and calls the
> library function for the second result, which produces a different
> result that differs in the last bit.
>
> Which is slightly surprising, but nothing that I lose sleep over...
>


More information about the Gcc-help mailing list