From 83193a5e723a0684fe656dc77161afb89898b933 Mon Sep 17 00:00:00 2001 From: Tue Ly Date: Mon, 25 Jul 2022 10:20:32 -0400 Subject: [PATCH] [libc] Raise FE_INVALID for sinf with +- inf inputs. --- libc/src/math/generic/sinf.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libc/src/math/generic/sinf.cpp b/libc/src/math/generic/sinf.cpp index 3175088..facf16b 100644 --- a/libc/src/math/generic/sinf.cpp +++ b/libc/src/math/generic/sinf.cpp @@ -159,8 +159,10 @@ LLVM_LIBC_FUNCTION(float, sinf, (float x)) { } else { // x is inf or nan. if (unlikely(x_abs >= 0x7f80'0000U)) { - if (x_abs == 0x7f80'0000U) + if (x_abs == 0x7f80'0000U) { errno = EDOM; + fputil::set_except(FE_INVALID); + } return x + FPBits::build_nan(1 << (fputil::MantissaWidth::VALUE - 1)); } -- 2.7.4