On Fri, 14 Jun 2019, Martin Jambor wrote: > Make sure you compile to a target that has the rounding instruction, > i.e. by using an appropriate -march or -mavx) and also specify > -ffast-math on the command line. I have not double checked, but I > assume the latter is necessary (mainly) because it implies > -fno-math-errno and most of the math builtin expansion into instructions > is guarded by check for !flag_errno_math.
fast-math should not be needed; roundeven should never set errno; the only exception it should ever raise should be "invalid" for signaling NaN arguments (a correct implementation should never raise "inexact"). (TS 18661-1 leaves it implementation-defined whether a signaling NaN input to a libm function causes a domain error. If we find an implementation where libm implements semantics such that it does cause a domain error and where errno is set for domain errors, *and* we wish the built-in functions to be consistent with that, that would be the point to consider a conditional to disable such expansion for flag_errno_math && flag_signaling_nans.) -- Joseph S. Myers jos...@codesourcery.com