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

Re: [Pkg-octave-devel] Unit test bug in octave-signal



On Mon, Nov 13, 2017 at 04:04:38PM +0100, Sébastien Villemot wrote:

> This has already been said several times on this list, but it is important to
> remember that it is normal to get slightly different numerical results on i386.
> The reason is that in i386, numerical computations are done with the x87 FPU,
> which internally stores double-floats with extra precision (80-bits), which
> means that when several consecutive mathematical operations are done within FPU
> registers, they do not conform to the IEEE 754 standard for double floats.
> On the contrary, amd64 uses SSE2 registers, which are 64-bit wide, and
> therefore conformant to the IEEE standard.

And I forgot to add that the easy workaround is to add the -ffloat-store option
to gcc. With this option, the result of every floating point operation is
copied back into memory (and read again) before moving to the next operation.
Therefore, every intermediate result gets truncated to 64-bit double float. As
a consequence, one gets exactly the same results as on amd64. But this has an
obvious performance cost (many additional memory read/writes, as many as there
are intermediate results). So one has to ponder carefully before using this option.

-- 
⢀⣴⠾⠻⢶⣦⠀  Sébastien Villemot
⣾⠁⢠⠒⠀⣿⡁  Debian Developer
⢿⡄⠘⠷⠚⠋⠀  http://sebastien.villemot.name
⠈⠳⣄⠀⠀⠀⠀  http://www.debian.org

Attachment: signature.asc
Description: PGP signature


Reply to: