MIN/MAX and trapping math and NANs

LIU Hao lh_mouse@126.com
Tue Apr 11 08:51:48 GMT 2023


在 2023/4/11 16:00, Richard Biener via Gcc 写道:
> I think without NaNs MIN/MAX cannot raise any exceptions (I'm not
> even sure whether MIN/MAX involving NaN will set invalid, but
> most certainly with sNaN it will trap and return a quiet NaN?).
> The C standard doesn't
> document any exceptions for fmax/fmin (even with NaN), but
> meanwhile there's a plethora of min/max function variants ...

My interpretation is that if one argument is a SNaN and the other is not, `fmax()` shall return the 
SNaN unchanged, without converting it to a QNaN. (F.10.9.2 The fmax functions, ISO/IEC 9899:2017)


-- 
Best regards,
LIU Hao

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20230411/fd8dbb42/attachment.sig>


More information about the Gcc mailing list