lua-users home
lua-l archive

Re: Inconsistent rounding of floating point hexadecimal literals

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


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.
-- 
Gé

AltStyle によって変換されたページ (->オリジナル) /