On Tue, 2024-03-26 at 11:15 +0800, YunQiang Su wrote:

/* snip */

> With -ffinite-math-only -fno-signed-zeros, it does work with
>     x >= y ? x : y
> while without `-ffinite-math-only -fno-signed-zeros`, it cannot.
> @Xi Ruoyao Is it expected by IEEE?

When y is (quiet) NaN and x is not, fmax(x, y) should produce x but x >=
y ? x : y should produce y.  Thus -ffinite-math-only is needed.

When x is +0.0 and y is -0.0, x >= y ? x : y should produce +0.0 but
fmax(x, y) may produce +0.0 or -0.0 (IEEE allows both and I don't see a
more strict requirement in MIPS 6.06 manual either).  Thus -fno-signed-
zeros is needed.

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to