lua-users home
lua-l archive

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


Actually the IEEE recommends rounding to the nearest <even>, not the nearest <even or odd>.


Le ven. 4 déc. 2020 à 18:28, Gé Weijers <ge@weijers.org> a écrit :
On Fri, Dec 4, 2020 at 9:25 AM Gé Weijers <ge@weijers.org> wrote:

> On a standard compliant C99 compiler you'd have to add:
>
> #include <fenv.h>
> /* ... */
>     #pragma STDC FENV_ACCESS ON
>     int setround_ok;
>     setround_ok = fesetround(round_dir);
>     assert(setround_ok == 0);
>
> I know Microsoft compilers have equivalent routines.
>
> --
> Gé


The value of round_dir should be FE_TONEAREST. My cut-and-paste was a
little too hasty.


--