summaryrefslogtreecommitdiff
path: root/libc/test/src/math/smoke
diff options
context:
space:
mode:
Diffstat (limited to 'libc/test/src/math/smoke')
-rw-r--r--libc/test/src/math/smoke/CMakeLists.txt421
-rw-r--r--libc/test/src/math/smoke/FModTest.h60
-rw-r--r--libc/test/src/math/smoke/LdExpTest.h11
-rw-r--r--libc/test/src/math/smoke/ModfTest.h10
-rw-r--r--libc/test/src/math/smoke/RoundToIntegerTest.h1
-rw-r--r--libc/test/src/math/smoke/TotalOrderMagTest.h47
-rw-r--r--libc/test/src/math/smoke/TotalOrderTest.h47
-rw-r--r--libc/test/src/math/smoke/acos_test.cpp4
-rw-r--r--libc/test/src/math/smoke/acosf16_test.cpp3
-rw-r--r--libc/test/src/math/smoke/acosf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/acoshf16_test.cpp3
-rw-r--r--libc/test/src/math/smoke/acoshf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/acospif16_test.cpp3
-rw-r--r--libc/test/src/math/smoke/asinf16_test.cpp3
-rw-r--r--libc/test/src/math/smoke/asinf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/asinhf16_test.cpp3
-rw-r--r--libc/test/src/math/smoke/asinhf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/asinpif16_test.cpp10
-rw-r--r--libc/test/src/math/smoke/atan2f_test.cpp3
-rw-r--r--libc/test/src/math/smoke/atanf16_test.cpp2
-rw-r--r--libc/test/src/math/smoke/atanf_test.cpp2
-rw-r--r--libc/test/src/math/smoke/atanhf16_test.cpp3
-rw-r--r--libc/test/src/math/smoke/atanhf_test.cpp3
-rw-r--r--libc/test/src/math/smoke/atanpif16_test.cpp63
-rw-r--r--libc/test/src/math/smoke/canonicalizebf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/copysignbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/cosf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/cosf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/coshf16_test.cpp6
-rw-r--r--libc/test/src/math/smoke/coshf_test.cpp5
-rw-r--r--libc/test/src/math/smoke/cospif16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/cospif_test.cpp4
-rw-r--r--libc/test/src/math/smoke/exp10_test.cpp9
-rw-r--r--libc/test/src/math/smoke/exp10f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp10f_test.cpp5
-rw-r--r--libc/test/src/math/smoke/exp10m1f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp10m1f_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp2_test.cpp9
-rw-r--r--libc/test/src/math/smoke/exp2f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp2f_test.cpp5
-rw-r--r--libc/test/src/math/smoke/exp2m1f16_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp2m1f_test.cpp8
-rw-r--r--libc/test/src/math/smoke/exp_test.cpp9
-rw-r--r--libc/test/src/math/smoke/expf16_test.cpp7
-rw-r--r--libc/test/src/math/smoke/expf_test.cpp5
-rw-r--r--libc/test/src/math/smoke/expm1_test.cpp8
-rw-r--r--libc/test/src/math/smoke/expm1f16_test.cpp7
-rw-r--r--libc/test/src/math/smoke/expm1f_test.cpp5
-rw-r--r--libc/test/src/math/smoke/fdimbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/fmodbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/frexpbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/ilogbbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/iscanonicalbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/issignalingbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/ldexpbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/llogbbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/log10_test.cpp8
-rw-r--r--libc/test/src/math/smoke/log10f16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/log10f_test.cpp8
-rw-r--r--libc/test/src/math/smoke/log1p_test.cpp6
-rw-r--r--libc/test/src/math/smoke/log1pf_test.cpp5
-rw-r--r--libc/test/src/math/smoke/log2_test.cpp7
-rw-r--r--libc/test/src/math/smoke/log2f16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/log2f_test.cpp7
-rw-r--r--libc/test/src/math/smoke/log_test.cpp7
-rw-r--r--libc/test/src/math/smoke/logbbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/logf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/logf_test.cpp6
-rw-r--r--libc/test/src/math/smoke/modfbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/remquobf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/scalblnbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/scalbnbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/sincos_test.cpp3
-rw-r--r--libc/test/src/math/smoke/sincosf_test.cpp3
-rw-r--r--libc/test/src/math/smoke/sinf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sinf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sinhf16_test.cpp6
-rw-r--r--libc/test/src/math/smoke/sinhf_test.cpp5
-rw-r--r--libc/test/src/math/smoke/sinpif16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sinpif_test.cpp4
-rw-r--r--libc/test/src/math/smoke/sqrtbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/tanf16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/tanf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/tanhf16_test.cpp6
-rw-r--r--libc/test/src/math/smoke/tanhf_test.cpp4
-rw-r--r--libc/test/src/math/smoke/tanpif16_test.cpp4
-rw-r--r--libc/test/src/math/smoke/tanpif_test.cpp4
-rw-r--r--libc/test/src/math/smoke/totalorderbf16_test.cpp14
-rw-r--r--libc/test/src/math/smoke/totalordermagbf16_test.cpp14
89 files changed, 913 insertions, 326 deletions
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 929d7b02fa96..b8d5ecf4d77e 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -8,7 +8,7 @@ add_fp_unittest(
SRCS
cosf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.cosf
)
@@ -19,7 +19,7 @@ add_fp_unittest(
SRCS
cosf16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.cosf16
)
@@ -30,7 +30,7 @@ add_fp_unittest(
SRCS
cospif_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.cospif
libc.src.__support.CPP.array
libc.src.__support.FPUtil.fp_bits
@@ -43,7 +43,7 @@ add_fp_unittest(
SRCS
cospif16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.cospif16
libc.src.__support.FPUtil.cast
)
@@ -55,7 +55,7 @@ add_fp_unittest(
SRCS
sinf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.sinf
libc.src.__support.CPP.array
libc.src.__support.FPUtil.fp_bits
@@ -68,7 +68,7 @@ add_fp_unittest(
SRCS
sinf16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.sinf16
libc.src.__support.FPUtil.cast
)
@@ -80,7 +80,7 @@ add_fp_unittest(
SRCS
sinpif_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.sinpif
libc.src.__support.CPP.array
libc.src.__support.FPUtil.fp_bits
@@ -93,7 +93,7 @@ add_fp_unittest(
SRCS
sinpif16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.sinpif16
)
@@ -104,7 +104,7 @@ add_fp_unittest(
SRCS
sincosf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.sincosf
libc.src.__support.CPP.array
libc.src.__support.FPUtil.fp_bits
@@ -117,7 +117,7 @@ add_fp_unittest(
SRCS
tanf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.tanf
libc.src.__support.CPP.array
libc.src.__support.FPUtil.fp_bits
@@ -130,7 +130,7 @@ add_fp_unittest(
SRCS
tanf16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.tanf16
)
@@ -141,7 +141,7 @@ add_fp_unittest(
SRCS
tanpif_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.tanpif
)
@@ -152,7 +152,7 @@ add_fp_unittest(
SRCS
tanpif16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.tanpif16
)
@@ -433,6 +433,22 @@ add_fp_unittest(
)
add_fp_unittest(
+ canonicalizebf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ canonicalizebf16_test.cpp
+ HDRS
+ CanonicalizeTest.h
+ DEPENDS
+ libc.src.math.canonicalizebf16
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.FPUtil.fenv_impl
+ libc.src.__support.integer_literals
+)
+
+add_fp_unittest(
iscanonical_test
SUITE
libc-math-smoke-tests
@@ -493,6 +509,19 @@ add_fp_unittest(
)
add_fp_unittest(
+ iscanonicalbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ iscanonicalbf16_test.cpp
+ HDRS
+ IsCanonicalTest.h
+ DEPENDS
+ libc.src.math.iscanonicalbf16
+ libc.src.__support.FPUtil.bfloat16
+)
+
+add_fp_unittest(
ceil_test
SUITE
libc-math-smoke-tests
@@ -604,7 +633,7 @@ add_fp_unittest(
HDRS
SubTest.h
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.math.dsubl
libc.src.__support.macros.properties.os
@@ -1336,7 +1365,7 @@ add_fp_unittest(
SRCS
exp_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.exp
libc.src.__support.FPUtil.fp_bits
)
@@ -1348,7 +1377,7 @@ add_fp_unittest(
SRCS
expf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.expf
libc.src.__support.FPUtil.fp_bits
)
@@ -1362,7 +1391,6 @@ add_fp_unittest(
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.expf16
libc.src.__support.FPUtil.cast
)
@@ -1374,7 +1402,7 @@ add_fp_unittest(
SRCS
exp2_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.exp2
libc.src.__support.FPUtil.fp_bits
)
@@ -1386,7 +1414,7 @@ add_fp_unittest(
SRCS
exp2f_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.exp2f
libc.src.__support.FPUtil.fp_bits
)
@@ -1398,8 +1426,8 @@ add_fp_unittest(
SRCS
exp2f16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.exp2f16
libc.src.__support.FPUtil.cast
)
@@ -1411,7 +1439,7 @@ add_fp_unittest(
SRCS
exp2m1f_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.exp2m1f
)
@@ -1422,8 +1450,8 @@ add_fp_unittest(
SRCS
exp2m1f16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.exp2m1f16
libc.src.__support.FPUtil.cast
)
@@ -1435,7 +1463,7 @@ add_fp_unittest(
SRCS
exp10_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.exp10
libc.src.__support.FPUtil.fp_bits
)
@@ -1447,7 +1475,7 @@ add_fp_unittest(
SRCS
exp10f_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.exp10f
libc.src.__support.FPUtil.fp_bits
)
@@ -1459,8 +1487,8 @@ add_fp_unittest(
SRCS
exp10f16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.exp10f16
libc.src.__support.FPUtil.cast
)
@@ -1472,8 +1500,8 @@ add_fp_unittest(
SRCS
exp10m1f16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.exp10m1f16
libc.src.__support.FPUtil.cast
)
@@ -1485,7 +1513,7 @@ add_fp_unittest(
SRCS
exp10m1f_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.exp10m1f
)
@@ -1560,6 +1588,21 @@ add_fp_unittest(
)
add_fp_unittest(
+ copysignbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ copysignbf16_test.cpp
+ HDRS
+ CopySignTest.h
+ DEPENDS
+ libc.src.math.copysignbf16
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
frexp_test
SUITE
libc-math-smoke-tests
@@ -1620,6 +1663,19 @@ add_fp_unittest(
)
add_fp_unittest(
+ frexpbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ frexpbf16_test.cpp
+ HDRS
+ FrexpTest.h
+ DEPENDS
+ libc.src.math.frexpbf16
+ libc.src.__support.FPUtil.bfloat16
+)
+
+add_fp_unittest(
fromfp_test
SUITE
libc-math-smoke-tests
@@ -1988,6 +2044,22 @@ add_fp_unittest(
)
add_fp_unittest(
+ ilogbbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ ilogbbf16_test.cpp
+ HDRS
+ ILogbTest.h
+ DEPENDS
+ libc.src.math.ilogbbf16
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.FPUtil.manipulation_functions
+)
+
+add_fp_unittest(
issignaling_test
SUITE
libc-math-smoke-tests
@@ -2048,6 +2120,19 @@ add_fp_unittest(
)
add_fp_unittest(
+ issignalingbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ issignalingbf16_test.cpp
+ HDRS
+ IsSignalingTest.h
+ DEPENDS
+ libc.src.math.issignalingbf16
+ libc.src.__support.FPUtil.bfloat16
+)
+
+add_fp_unittest(
llogb_test
SUITE
libc-math-smoke-tests
@@ -2123,6 +2208,22 @@ add_fp_unittest(
)
add_fp_unittest(
+ llogbbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ llogbbf16_test.cpp
+ HDRS
+ ILogbTest.h
+ DEPENDS
+ libc.src.math.llogbbf16
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.FPUtil.manipulation_functions
+)
+
+add_fp_unittest(
ldexp_test
SUITE
libc-math-smoke-tests
@@ -2132,6 +2233,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexp
+ libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@@ -2147,6 +2249,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpf
+ libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@@ -2162,6 +2265,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpl
+ libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@@ -2177,6 +2281,7 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpf16
+ libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
@@ -2192,7 +2297,25 @@ add_fp_unittest(
LdExpTest.h
DEPENDS
libc.src.math.ldexpf128
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
+ ldexpbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ ldexpbf16_test.cpp
+ HDRS
+ LdExpTest.h
+ DEPENDS
+ libc.src.math.ldexpbf16
+ libc.src.__support.CPP.algorithm
libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.normal_float
)
@@ -2268,6 +2391,21 @@ add_fp_unittest(
)
add_fp_unittest(
+ logbbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ logbbf16_test.cpp
+ HDRS
+ LogbTest.h
+ DEPENDS
+ libc.src.math.logbbf16
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.manipulation_functions
+)
+
+add_fp_unittest(
modf_test
SUITE
libc-math-smoke-tests
@@ -2343,6 +2481,22 @@ add_fp_unittest(
)
add_fp_unittest(
+ modfbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ modfbf16_test.cpp
+ HDRS
+ ModfTest.h
+ DEPENDS
+ libc.src.math.modfbf16
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.nearest_integer_operations
+)
+
+add_fp_unittest(
fdimf_test
SUITE
libc-math-smoke-tests
@@ -2413,6 +2567,21 @@ add_fp_unittest(
)
add_fp_unittest(
+ fdimbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ fdimbf16_test.cpp
+ HDRS
+ FDimTest.h
+ DEPENDS
+ libc.src.math.fdimbf16
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
fminf_test
SUITE
libc-math-smoke-tests
@@ -3358,6 +3527,19 @@ add_fp_unittest(
)
add_fp_unittest(
+ sqrtbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ sqrtbf16_test.cpp
+ HDRS
+ SqrtTest.h
+ DEPENDS
+ libc.src.math.sqrtbf16
+ libc.src.__support.FPUtil.bfloat16
+)
+
+add_fp_unittest(
generic_sqrtf_test
SUITE
libc-math-smoke-tests
@@ -3483,6 +3665,20 @@ add_fp_unittest(
)
add_fp_unittest(
+ remquobf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ remquobf16_test.cpp
+ HDRS
+ RemQuoTest.h
+ DEPENDS
+ libc.src.math.remquobf16
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
hypotf_test
SUITE
libc-math-smoke-tests
@@ -4068,7 +4264,7 @@ add_fp_unittest(
SRCS
expm1_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.expm1
libc.src.__support.FPUtil.fp_bits
)
@@ -4080,7 +4276,7 @@ add_fp_unittest(
SRCS
expm1f_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.expm1f
libc.src.__support.FPUtil.fp_bits
)
@@ -4094,7 +4290,6 @@ add_fp_unittest(
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.expm1f16
libc.src.__support.FPUtil.cast
)
@@ -4106,7 +4301,7 @@ add_fp_unittest(
SRCS
log_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.log
libc.src.__support.FPUtil.fp_bits
)
@@ -4118,7 +4313,7 @@ add_fp_unittest(
SRCS
logf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.logf
libc.src.__support.FPUtil.fp_bits
)
@@ -4130,8 +4325,8 @@ add_fp_unittest(
SRCS
logf16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.logf16
libc.src.__support.FPUtil.cast
)
@@ -4143,7 +4338,7 @@ add_fp_unittest(
SRCS
log2_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.log2
libc.src.__support.FPUtil.fp_bits
)
@@ -4155,7 +4350,7 @@ add_fp_unittest(
SRCS
log2f_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.log2f
libc.src.__support.FPUtil.fp_bits
)
@@ -4167,8 +4362,8 @@ add_fp_unittest(
SRCS
log2f16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.log2f16
libc.src.__support.FPUtil.cast
)
@@ -4180,7 +4375,7 @@ add_fp_unittest(
SRCS
log10_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.log10
libc.src.__support.FPUtil.fp_bits
)
@@ -4192,7 +4387,7 @@ add_fp_unittest(
SRCS
log10f_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.log10f
libc.src.__support.FPUtil.fp_bits
)
@@ -4204,8 +4399,8 @@ add_fp_unittest(
SRCS
log10f16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.log10f16
libc.src.__support.FPUtil.cast
)
@@ -4217,7 +4412,7 @@ add_fp_unittest(
SRCS
log1p_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.log1p
libc.src.__support.FPUtil.fp_bits
)
@@ -4229,7 +4424,7 @@ add_fp_unittest(
SRCS
log1pf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.log1pf
libc.src.__support.FPUtil.fp_bits
)
@@ -4243,8 +4438,8 @@ add_fp_unittest(
HDRS
FModTest.h
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.fmodf
libc.src.__support.FPUtil.fenv_impl
# FIXME: Currently fails on the GPU build.
@@ -4260,8 +4455,8 @@ add_fp_unittest(
HDRS
FModTest.h
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.fmod
libc.src.__support.FPUtil.fenv_impl
# FIXME: Currently fails on the GPU build.
@@ -4277,8 +4472,8 @@ add_fp_unittest(
HDRS
FModTest.h
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.fmodl
libc.src.__support.FPUtil.fenv_impl
# FIXME: Currently fails on the GPU build.
@@ -4294,8 +4489,8 @@ add_fp_unittest(
HDRS
FModTest.h
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.fmodf16
libc.src.__support.FPUtil.fenv_impl
# FIXME: Currently fails on the GPU build.
@@ -4311,8 +4506,8 @@ add_fp_unittest(
HDRS
FModTest.h
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.fmodf128
libc.src.__support.FPUtil.fenv_impl
# FIXME: Currently fails on the GPU build.
@@ -4320,13 +4515,30 @@ add_fp_unittest(
)
add_fp_unittest(
+ fmodbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ fmodbf16_test.cpp
+ HDRS
+ FModTest.h
+ DEPENDS
+ libc.hdr.errno_macros
+ libc.hdr.fenv_macros
+ libc.src.math.fmodbf16
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fenv_impl
+ UNIT_TEST_ONLY
+)
+
+add_fp_unittest(
coshf_test
SUITE
libc-math-smoke-tests
SRCS
coshf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.coshf
libc.src.__support.CPP.array
libc.src.__support.FPUtil.fp_bits
@@ -4339,8 +4551,8 @@ add_fp_unittest(
SRCS
coshf16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.coshf16
libc.src.__support.FPUtil.cast
)
@@ -4352,7 +4564,7 @@ add_fp_unittest(
SRCS
sinhf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.sinhf
libc.src.__support.CPP.array
libc.src.__support.FPUtil.fp_bits
@@ -4365,8 +4577,8 @@ add_fp_unittest(
SRCS
sinhf16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.sinhf16
libc.src.__support.FPUtil.cast
)
@@ -4378,6 +4590,7 @@ add_fp_unittest(
SRCS
tanhf_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.src.math.tanhf
libc.src.__support.FPUtil.fp_bits
)
@@ -4389,8 +4602,8 @@ add_fp_unittest(
SRCS
tanhf16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.tanhf16
libc.src.__support.FPUtil.cast
)
@@ -4402,7 +4615,7 @@ add_fp_unittest(
SRCS
atanhf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.atanhf
libc.src.__support.FPUtil.fp_bits
)
@@ -4414,19 +4627,30 @@ add_fp_unittest(
SRCS
atanhf16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.atanhf16
libc.src.__support.FPUtil.cast
)
add_fp_unittest(
+ atanpif16_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ atanpif16_test.cpp
+ DEPENDS
+ libc.src.math.atanpif16
+)
+
+add_fp_unittest(
asinhf_test
SUITE
libc-math-smoke-tests
SRCS
asinhf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.asinhf
libc.src.__support.FPUtil.fp_bits
)
@@ -4438,7 +4662,7 @@ add_fp_unittest(
SRCS
asinhf16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.asinhf16
)
@@ -4450,8 +4674,8 @@ add_fp_unittest(
SRCS
asinpif16_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.src.math.asinpif16
- libc.src.errno.errno
)
add_fp_unittest(
@@ -4461,7 +4685,7 @@ add_fp_unittest(
SRCS
acoshf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.acoshf
libc.src.__support.FPUtil.fp_bits
)
@@ -4473,7 +4697,7 @@ add_fp_unittest(
SRCS
acoshf16_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.acoshf16
libc.src.__support.FPUtil.cast
)
@@ -4485,7 +4709,7 @@ add_fp_unittest(
SRCS
asinf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.asinf
libc.src.__support.FPUtil.fp_bits
)
@@ -4507,8 +4731,8 @@ add_fp_unittest(
SRCS
asinf16_test.cpp
DEPENDS
- libc.src.errno.errno
- libc.src.math.asinf16
+ libc.hdr.errno_macros
+ libc.src.math.asinf16
)
add_fp_unittest(
@@ -4518,7 +4742,7 @@ add_fp_unittest(
SRCS
acosf_test.cpp
DEPENDS
- libc.src.errno.errno
+ libc.hdr.errno_macros
libc.src.math.acosf
libc.src.__support.FPUtil.fp_bits
)
@@ -4530,8 +4754,8 @@ add_fp_unittest(
SRCS
acos_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.hdr.fenv_macros
- libc.src.errno.errno
libc.src.math.acos
)
@@ -4542,8 +4766,8 @@ add_fp_unittest(
SRCS
acosf16_test.cpp
DEPENDS
- libc.src.errno.errno
- libc.src.math.acosf16
+ libc.hdr.errno_macros
+ libc.src.math.acosf16
)
add_fp_unittest(
@@ -4553,8 +4777,8 @@ add_fp_unittest(
SRCS
acospif16_test.cpp
DEPENDS
- libc.src.errno.errno
- libc.src.math.acospif16
+ libc.hdr.errno_macros
+ libc.src.math.acospif16
)
add_fp_unittest(
@@ -4564,7 +4788,6 @@ add_fp_unittest(
SRCS
atanf_test.cpp
DEPENDS
- libc.src.errno.errno
libc.src.math.atanf
libc.src.__support.FPUtil.fp_bits
)
@@ -4586,7 +4809,6 @@ add_fp_unittest(
SRCS
atanf16_test.cpp
DEPENDS
- libc.src.errno.errno
libc.src.math.atanf16
)
@@ -4597,7 +4819,6 @@ add_fp_unittest(
SRCS
atan2f_test.cpp
DEPENDS
- libc.src.errno.errno
libc.src.math.atan2f
libc.src.__support.FPUtil.fp_bits
)
@@ -4698,6 +4919,22 @@ add_fp_unittest(
)
add_fp_unittest(
+ scalblnbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ scalblnbf16_test.cpp
+ HDRS
+ ScalbnTest.h
+ DEPENDS
+ libc.src.math.scalblnbf16
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
scalbn_test
SUITE
libc-math-smoke-tests
@@ -4773,6 +5010,22 @@ add_fp_unittest(
)
add_fp_unittest(
+ scalbnbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ scalbnbf16_test.cpp
+ HDRS
+ ScalbnTest.h
+ DEPENDS
+ libc.src.math.scalbnbf16
+ libc.src.__support.CPP.limits
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
erff_test
SUITE
libc-math-smoke-tests
@@ -4790,7 +5043,6 @@ add_fp_unittest(
SRCS
pow_test.cpp
DEPENDS
- libc.src.errno.errno
libc.hdr.fenv_macros
libc.src.math.pow
)
@@ -4867,6 +5119,19 @@ add_fp_unittest(
)
add_fp_unittest(
+ totalorderbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ totalorderbf16_test.cpp
+ HDRS
+ TotalOrderTest.h
+ DEPENDS
+ libc.src.math.totalorderbf16
+ libc.src.__support.FPUtil.bfloat16
+)
+
+add_fp_unittest(
totalordermag_test
SUITE
libc-math-smoke-tests
@@ -4927,6 +5192,19 @@ add_fp_unittest(
)
add_fp_unittest(
+ totalordermagbf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ totalordermagbf16_test.cpp
+ HDRS
+ TotalOrderMagTest.h
+ DEPENDS
+ libc.src.math.totalordermagbf16
+ libc.src.__support.FPUtil.bfloat16
+)
+
+add_fp_unittest(
getpayload_test
SUITE
libc-math-smoke-tests
@@ -5635,6 +5913,7 @@ add_fp_unittest(
SRCS
sincos_test.cpp
DEPENDS
+ libc.hdr.errno_macros
libc.src.math.sincos
)
diff --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h
index 04cbc659ece5..493f19763c74 100644
--- a/libc/test/src/math/smoke/FModTest.h
+++ b/libc/test/src/math/smoke/FModTest.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H
+#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/FEnvImpl.h"
-#include "src/__support/libc_errno.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -31,12 +31,22 @@ class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
DECLARE_SPECIAL_CONSTANTS(T)
+ static constexpr T one = T(1.0);
+ static constexpr T two = T(2.0);
+ static constexpr T neg_two = T(-2.0);
+ static constexpr T three = T(3.0);
+ static constexpr T val_neg_1_1 = T(-1.1);
+ static constexpr T val_6_5 = T(6.5);
+ static constexpr T val_neg_6_5 = T(-6.5);
+ static constexpr T val_2_25 = T(2.25);
+ static constexpr T val_neg_2_25 = T(-2.25);
+
public:
typedef T (*FModFunc)(T, T);
void testSpecialNumbers(FModFunc f) {
// fmod (+0, y) == +0 for y != 0.
- TEST_SPECIAL(zero, T(3.0), zero, false, 0);
+ TEST_SPECIAL(zero, three, zero, false, 0);
TEST_SPECIAL(zero, min_denormal, zero, false, 0);
TEST_SPECIAL(zero, -min_denormal, zero, false, 0);
TEST_SPECIAL(zero, min_normal, zero, false, 0);
@@ -45,7 +55,7 @@ public:
TEST_SPECIAL(zero, -max_normal, zero, false, 0);
// fmod (-0, y) == -0 for y != 0.
- TEST_SPECIAL(neg_zero, T(3.0), neg_zero, false, 0);
+ TEST_SPECIAL(neg_zero, three, neg_zero, false, 0);
TEST_SPECIAL(neg_zero, min_denormal, neg_zero, false, 0);
TEST_SPECIAL(neg_zero, -min_denormal, neg_zero, false, 0);
TEST_SPECIAL(neg_zero, min_normal, neg_zero, false, 0);
@@ -54,8 +64,8 @@ public:
TEST_SPECIAL(neg_zero, -max_normal, neg_zero, false, 0);
// fmod (+inf, y) == aNaN plus invalid exception.
- TEST_SPECIAL(inf, T(3.0), aNaN, true, FE_INVALID);
- TEST_SPECIAL(inf, T(-1.1), aNaN, true, FE_INVALID);
+ TEST_SPECIAL(inf, three, aNaN, true, FE_INVALID);
+ TEST_SPECIAL(inf, val_neg_1_1, aNaN, true, FE_INVALID);
TEST_SPECIAL(inf, zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(inf, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(inf, min_denormal, aNaN, true, FE_INVALID);
@@ -65,8 +75,8 @@ public:
TEST_SPECIAL(inf, neg_inf, aNaN, true, FE_INVALID);
// fmod (-inf, y) == aNaN plus invalid exception.
- TEST_SPECIAL(neg_inf, T(3.0), aNaN, true, FE_INVALID);
- TEST_SPECIAL(neg_inf, T(-1.1), aNaN, true, FE_INVALID);
+ TEST_SPECIAL(neg_inf, three, aNaN, true, FE_INVALID);
+ TEST_SPECIAL(neg_inf, val_neg_1_1, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_inf, zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_inf, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_inf, min_denormal, aNaN, true, FE_INVALID);
@@ -76,8 +86,8 @@ public:
TEST_SPECIAL(neg_inf, neg_inf, aNaN, true, FE_INVALID);
// fmod (x, +0) == aNaN plus invalid exception.
- TEST_SPECIAL(T(3.0), zero, aNaN, true, FE_INVALID);
- TEST_SPECIAL(T(-1.1), zero, aNaN, true, FE_INVALID);
+ TEST_SPECIAL(three, zero, aNaN, true, FE_INVALID);
+ TEST_SPECIAL(val_neg_1_1, zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(zero, zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_zero, zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(min_denormal, zero, aNaN, true, FE_INVALID);
@@ -85,8 +95,8 @@ public:
TEST_SPECIAL(max_normal, zero, aNaN, true, FE_INVALID);
// fmod (x, -0) == aNaN plus invalid exception.
- TEST_SPECIAL(T(3.0), neg_zero, aNaN, true, FE_INVALID);
- TEST_SPECIAL(T(-1.1), neg_zero, aNaN, true, FE_INVALID);
+ TEST_SPECIAL(three, neg_zero, aNaN, true, FE_INVALID);
+ TEST_SPECIAL(val_neg_1_1, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(zero, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(neg_zero, neg_zero, aNaN, true, FE_INVALID);
TEST_SPECIAL(min_denormal, neg_zero, aNaN, true, FE_INVALID);
@@ -99,21 +109,21 @@ public:
TEST_SPECIAL(min_denormal, inf, min_denormal, false, 0);
TEST_SPECIAL(min_normal, inf, min_normal, false, 0);
TEST_SPECIAL(max_normal, inf, max_normal, false, 0);
- TEST_SPECIAL(T(3.0), inf, T(3.0), false, 0);
+ TEST_SPECIAL(three, inf, three, false, 0);
// fmod (x, -inf) == x for x not infinite.
TEST_SPECIAL(zero, neg_inf, zero, false, 0);
TEST_SPECIAL(neg_zero, neg_inf, neg_zero, false, 0);
TEST_SPECIAL(min_denormal, neg_inf, min_denormal, false, 0);
TEST_SPECIAL(min_normal, neg_inf, min_normal, false, 0);
TEST_SPECIAL(max_normal, neg_inf, max_normal, false, 0);
- TEST_SPECIAL(T(3.0), neg_inf, T(3.0), false, 0);
+ TEST_SPECIAL(three, neg_inf, three, false, 0);
TEST_SPECIAL(zero, aNaN, aNaN, false, 0);
TEST_SPECIAL(zero, neg_aNaN, aNaN, false, 0);
TEST_SPECIAL(neg_zero, aNaN, aNaN, false, 0);
TEST_SPECIAL(neg_zero, neg_aNaN, aNaN, false, 0);
- TEST_SPECIAL(T(1.0), aNaN, aNaN, false, 0);
- TEST_SPECIAL(T(1.0), neg_aNaN, aNaN, false, 0);
+ TEST_SPECIAL(one, aNaN, aNaN, false, 0);
+ TEST_SPECIAL(one, neg_aNaN, aNaN, false, 0);
TEST_SPECIAL(inf, aNaN, aNaN, false, 0);
TEST_SPECIAL(inf, neg_aNaN, aNaN, false, 0);
TEST_SPECIAL(neg_inf, aNaN, aNaN, false, 0);
@@ -122,8 +132,8 @@ public:
TEST_SPECIAL(zero, neg_sNaN, aNaN, false, FE_INVALID);
TEST_SPECIAL(neg_zero, sNaN, aNaN, false, FE_INVALID);
TEST_SPECIAL(neg_zero, neg_sNaN, aNaN, false, FE_INVALID);
- TEST_SPECIAL(T(1.0), sNaN, aNaN, false, FE_INVALID);
- TEST_SPECIAL(T(1.0), neg_sNaN, aNaN, false, FE_INVALID);
+ TEST_SPECIAL(one, sNaN, aNaN, false, FE_INVALID);
+ TEST_SPECIAL(one, neg_sNaN, aNaN, false, FE_INVALID);
TEST_SPECIAL(inf, sNaN, aNaN, false, FE_INVALID);
TEST_SPECIAL(inf, neg_sNaN, aNaN, false, FE_INVALID);
TEST_SPECIAL(neg_inf, sNaN, aNaN, false, FE_INVALID);
@@ -132,8 +142,8 @@ public:
TEST_SPECIAL(neg_aNaN, zero, aNaN, false, 0);
TEST_SPECIAL(aNaN, neg_zero, aNaN, false, 0);
TEST_SPECIAL(neg_aNaN, neg_zero, aNaN, false, 0);
- TEST_SPECIAL(aNaN, T(1.0), aNaN, false, 0);
- TEST_SPECIAL(neg_aNaN, T(1.0), aNaN, false, 0);
+ TEST_SPECIAL(aNaN, one, aNaN, false, 0);
+ TEST_SPECIAL(neg_aNaN, one, aNaN, false, 0);
TEST_SPECIAL(aNaN, inf, aNaN, false, 0);
TEST_SPECIAL(neg_aNaN, inf, aNaN, false, 0);
TEST_SPECIAL(aNaN, neg_inf, aNaN, false, 0);
@@ -142,8 +152,8 @@ public:
TEST_SPECIAL(neg_sNaN, zero, aNaN, false, FE_INVALID);
TEST_SPECIAL(sNaN, neg_zero, aNaN, false, FE_INVALID);
TEST_SPECIAL(neg_sNaN, neg_zero, aNaN, false, FE_INVALID);
- TEST_SPECIAL(sNaN, T(1.0), aNaN, false, FE_INVALID);
- TEST_SPECIAL(neg_sNaN, T(1.0), aNaN, false, FE_INVALID);
+ TEST_SPECIAL(sNaN, one, aNaN, false, FE_INVALID);
+ TEST_SPECIAL(neg_sNaN, one, aNaN, false, FE_INVALID);
TEST_SPECIAL(sNaN, inf, aNaN, false, FE_INVALID);
TEST_SPECIAL(neg_sNaN, inf, aNaN, false, FE_INVALID);
TEST_SPECIAL(sNaN, neg_inf, aNaN, false, FE_INVALID);
@@ -165,10 +175,10 @@ public:
TEST_SPECIAL(neg_sNaN, sNaN, aNaN, false, FE_INVALID);
TEST_SPECIAL(neg_sNaN, neg_sNaN, aNaN, false, FE_INVALID);
- TEST_SPECIAL(T(6.5), T(2.25), T(2.0), false, 0);
- TEST_SPECIAL(T(-6.5), T(2.25), T(-2.0), false, 0);
- TEST_SPECIAL(T(6.5), T(-2.25), T(2.0), false, 0);
- TEST_SPECIAL(T(-6.5), T(-2.25), T(-2.0), false, 0);
+ TEST_SPECIAL(val_6_5, val_2_25, two, false, 0);
+ TEST_SPECIAL(val_neg_6_5, val_2_25, neg_two, false, 0);
+ TEST_SPECIAL(val_6_5, val_neg_2_25, two, false, 0);
+ TEST_SPECIAL(val_neg_6_5, val_neg_2_25, neg_two, false, 0);
TEST_SPECIAL(max_normal, max_normal, zero, false, 0);
TEST_SPECIAL(max_normal, -max_normal, zero, false, 0);
diff --git a/libc/test/src/math/smoke/LdExpTest.h b/libc/test/src/math/smoke/LdExpTest.h
index 8de70ad161ad..d005f053c0c9 100644
--- a/libc/test/src/math/smoke/LdExpTest.h
+++ b/libc/test/src/math/smoke/LdExpTest.h
@@ -10,7 +10,8 @@
#define LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
#include "hdr/stdint_proxy.h"
-#include "src/__support/CPP/limits.h" // INT_MAX
+#include "src/__support/CPP/algorithm.h" // cpp::min
+#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/NormalFloat.h"
#include "test/UnitTest/FEnvSafeTest.h"
@@ -135,8 +136,8 @@ public:
// Normal which trigger mantissa overflow.
T x = NormalFloat(Sign::POS, -FPBits::EXP_BIAS + 1,
StorageType(2) * NormalFloat::ONE - StorageType(1));
- ASSERT_FP_EQ(func(x, -1), x / 2);
- ASSERT_FP_EQ(func(-x, -1), -x / 2);
+ ASSERT_FP_EQ(func(x, -1), T(x / 2));
+ ASSERT_FP_EQ(func(-x, -1), -T(x / 2));
// Start with a normal number high exponent but pass a very low number for
// exp. The result should be a subnormal number.
@@ -154,7 +155,9 @@ public:
// Start with a subnormal number but pass a very high number for exponent.
// The result should not be infinity.
- x = NormalFloat(Sign::POS, -FPBits::EXP_BIAS + 1, NormalFloat::ONE >> 10);
+ x = NormalFloat(Sign::POS, -FPBits::EXP_BIAS + 1,
+ NormalFloat::ONE >>
+ LIBC_NAMESPACE::cpp::min(FPBits::FRACTION_LEN, 10));
exp = FPBits::MAX_BIASED_EXPONENT + 5;
ASSERT_FALSE(FPBits(func(x, exp)).is_inf());
// But if the exp is large enough to oversome than the normalization shift,
diff --git a/libc/test/src/math/smoke/ModfTest.h b/libc/test/src/math/smoke/ModfTest.h
index 24cfb1152c2e..71f1c6bf4be2 100644
--- a/libc/test/src/math/smoke/ModfTest.h
+++ b/libc/test/src/math/smoke/ModfTest.h
@@ -76,10 +76,16 @@ public:
EXPECT_FP_EQ(T(-0.75), func(T(-10.75), &integral));
EXPECT_FP_EQ(integral, T(-10.0));
- EXPECT_FP_EQ(T(0.125), func(T(100.125), &integral));
+ EXPECT_FP_EQ(T(0.125), func(T(31.125), &integral));
+ EXPECT_FP_EQ(integral, T(31.0));
+
+ EXPECT_FP_EQ(T(-0.125), func(T(-31.125), &integral));
+ EXPECT_FP_EQ(integral, T(-31.0));
+
+ EXPECT_FP_EQ(T(0.5), func(T(100.5), &integral));
EXPECT_FP_EQ(integral, T(100.0));
- EXPECT_FP_EQ(T(-0.125), func(T(-100.125), &integral));
+ EXPECT_FP_EQ(T(-0.5), func(T(-100.5), &integral));
EXPECT_FP_EQ(integral, T(-100.0));
}
diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h
index 6866e9109ca0..f8be5a5bcc73 100644
--- a/libc/test/src/math/smoke/RoundToIntegerTest.h
+++ b/libc/test/src/math/smoke/RoundToIntegerTest.h
@@ -12,6 +12,7 @@
#include "src/__support/CPP/algorithm.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/libc_errno.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/math/smoke/TotalOrderMagTest.h b/libc/test/src/math/smoke/TotalOrderMagTest.h
index 0a13fd2922e4..8a389df08932 100644
--- a/libc/test/src/math/smoke/TotalOrderMagTest.h
+++ b/libc/test/src/math/smoke/TotalOrderMagTest.h
@@ -106,24 +106,45 @@ public:
}
void testNaNPayloads(TotalOrderMagFunc func) {
- T qnan_0x42 = FPBits::quiet_nan(Sign::POS, 0x42).get_val();
- T neg_qnan_0x42 = FPBits::quiet_nan(Sign::NEG, 0x42).get_val();
- T snan_0x42 = FPBits::signaling_nan(Sign::POS, 0x42).get_val();
- T neg_snan_0x42 = FPBits::signaling_nan(Sign::NEG, 0x42).get_val();
-
EXPECT_TRUE(funcWrapper(func, aNaN, aNaN));
EXPECT_TRUE(funcWrapper(func, sNaN, sNaN));
- EXPECT_TRUE(funcWrapper(func, aNaN, qnan_0x42));
- EXPECT_FALSE(funcWrapper(func, sNaN, snan_0x42));
- EXPECT_FALSE(funcWrapper(func, qnan_0x42, aNaN));
- EXPECT_TRUE(funcWrapper(func, snan_0x42, sNaN));
EXPECT_TRUE(funcWrapper(func, neg_aNaN, neg_aNaN));
EXPECT_TRUE(funcWrapper(func, neg_sNaN, neg_sNaN));
- EXPECT_TRUE(funcWrapper(func, neg_aNaN, neg_qnan_0x42));
- EXPECT_FALSE(funcWrapper(func, neg_sNaN, neg_snan_0x42));
- EXPECT_FALSE(funcWrapper(func, neg_qnan_0x42, neg_aNaN));
- EXPECT_TRUE(funcWrapper(func, neg_snan_0x42, neg_sNaN));
+
+ if constexpr (FPBits::FRACTION_LEN - 1 >= 5) {
+ T qnan_0x15 = FPBits::quiet_nan(Sign::POS, 0x15).get_val();
+ T neg_qnan_0x15 = FPBits::quiet_nan(Sign::NEG, 0x15).get_val();
+ T snan_0x15 = FPBits::signaling_nan(Sign::POS, 0x15).get_val();
+ T neg_snan_0x15 = FPBits::signaling_nan(Sign::NEG, 0x15).get_val();
+
+ EXPECT_TRUE(funcWrapper(func, aNaN, qnan_0x15));
+ EXPECT_FALSE(funcWrapper(func, sNaN, snan_0x15));
+ EXPECT_FALSE(funcWrapper(func, qnan_0x15, aNaN));
+ EXPECT_TRUE(funcWrapper(func, snan_0x15, sNaN));
+
+ EXPECT_TRUE(funcWrapper(func, neg_aNaN, neg_qnan_0x15));
+ EXPECT_FALSE(funcWrapper(func, neg_sNaN, neg_snan_0x15));
+ EXPECT_FALSE(funcWrapper(func, neg_qnan_0x15, neg_aNaN));
+ EXPECT_TRUE(funcWrapper(func, neg_snan_0x15, neg_sNaN));
+ }
+
+ if constexpr (FPBits::FRACTION_LEN - 1 >= 7) {
+ T qnan_0x42 = FPBits::quiet_nan(Sign::POS, 0x42).get_val();
+ T neg_qnan_0x42 = FPBits::quiet_nan(Sign::NEG, 0x42).get_val();
+ T snan_0x42 = FPBits::signaling_nan(Sign::POS, 0x42).get_val();
+ T neg_snan_0x42 = FPBits::signaling_nan(Sign::NEG, 0x42).get_val();
+
+ EXPECT_TRUE(funcWrapper(func, aNaN, qnan_0x42));
+ EXPECT_FALSE(funcWrapper(func, sNaN, snan_0x42));
+ EXPECT_FALSE(funcWrapper(func, qnan_0x42, aNaN));
+ EXPECT_TRUE(funcWrapper(func, snan_0x42, sNaN));
+
+ EXPECT_TRUE(funcWrapper(func, neg_aNaN, neg_qnan_0x42));
+ EXPECT_FALSE(funcWrapper(func, neg_sNaN, neg_snan_0x42));
+ EXPECT_FALSE(funcWrapper(func, neg_qnan_0x42, neg_aNaN));
+ EXPECT_TRUE(funcWrapper(func, neg_snan_0x42, neg_sNaN));
+ }
}
};
diff --git a/libc/test/src/math/smoke/TotalOrderTest.h b/libc/test/src/math/smoke/TotalOrderTest.h
index e426eb35016b..50aac202f202 100644
--- a/libc/test/src/math/smoke/TotalOrderTest.h
+++ b/libc/test/src/math/smoke/TotalOrderTest.h
@@ -104,24 +104,45 @@ public:
}
void testNaNPayloads(TotalOrderFunc func) {
- T qnan_0x42 = FPBits::quiet_nan(Sign::POS, 0x42).get_val();
- T neg_qnan_0x42 = FPBits::quiet_nan(Sign::NEG, 0x42).get_val();
- T snan_0x42 = FPBits::signaling_nan(Sign::POS, 0x42).get_val();
- T neg_snan_0x42 = FPBits::signaling_nan(Sign::NEG, 0x42).get_val();
-
EXPECT_TRUE(funcWrapper(func, aNaN, aNaN));
EXPECT_TRUE(funcWrapper(func, sNaN, sNaN));
- EXPECT_TRUE(funcWrapper(func, aNaN, qnan_0x42));
- EXPECT_FALSE(funcWrapper(func, sNaN, snan_0x42));
- EXPECT_FALSE(funcWrapper(func, qnan_0x42, aNaN));
- EXPECT_TRUE(funcWrapper(func, snan_0x42, sNaN));
EXPECT_TRUE(funcWrapper(func, neg_aNaN, neg_aNaN));
EXPECT_TRUE(funcWrapper(func, neg_sNaN, neg_sNaN));
- EXPECT_FALSE(funcWrapper(func, neg_aNaN, neg_qnan_0x42));
- EXPECT_TRUE(funcWrapper(func, neg_sNaN, neg_snan_0x42));
- EXPECT_TRUE(funcWrapper(func, neg_qnan_0x42, neg_aNaN));
- EXPECT_FALSE(funcWrapper(func, neg_snan_0x42, neg_sNaN));
+
+ if constexpr (FPBits::FRACTION_LEN - 1 >= 5) {
+ T qnan_0x15 = FPBits::quiet_nan(Sign::POS, 0x15).get_val();
+ T neg_qnan_0x15 = FPBits::quiet_nan(Sign::NEG, 0x15).get_val();
+ T snan_0x15 = FPBits::signaling_nan(Sign::POS, 0x15).get_val();
+ T neg_snan_0x15 = FPBits::signaling_nan(Sign::NEG, 0x15).get_val();
+
+ EXPECT_TRUE(funcWrapper(func, aNaN, qnan_0x15));
+ EXPECT_FALSE(funcWrapper(func, sNaN, snan_0x15));
+ EXPECT_FALSE(funcWrapper(func, qnan_0x15, aNaN));
+ EXPECT_TRUE(funcWrapper(func, snan_0x15, sNaN));
+
+ EXPECT_FALSE(funcWrapper(func, neg_aNaN, neg_qnan_0x15));
+ EXPECT_TRUE(funcWrapper(func, neg_sNaN, neg_snan_0x15));
+ EXPECT_TRUE(funcWrapper(func, neg_qnan_0x15, neg_aNaN));
+ EXPECT_FALSE(funcWrapper(func, neg_snan_0x15, neg_sNaN));
+ }
+
+ if constexpr (FPBits::FRACTION_LEN - 1 >= 7) {
+ T qnan_0x42 = FPBits::quiet_nan(Sign::POS, 0x42).get_val();
+ T neg_qnan_0x42 = FPBits::quiet_nan(Sign::NEG, 0x42).get_val();
+ T snan_0x42 = FPBits::signaling_nan(Sign::POS, 0x42).get_val();
+ T neg_snan_0x42 = FPBits::signaling_nan(Sign::NEG, 0x42).get_val();
+
+ EXPECT_TRUE(funcWrapper(func, aNaN, qnan_0x42));
+ EXPECT_FALSE(funcWrapper(func, sNaN, snan_0x42));
+ EXPECT_FALSE(funcWrapper(func, qnan_0x42, aNaN));
+ EXPECT_TRUE(funcWrapper(func, snan_0x42, sNaN));
+
+ EXPECT_FALSE(funcWrapper(func, neg_aNaN, neg_qnan_0x42));
+ EXPECT_TRUE(funcWrapper(func, neg_sNaN, neg_snan_0x42));
+ EXPECT_TRUE(funcWrapper(func, neg_qnan_0x42, neg_aNaN));
+ EXPECT_FALSE(funcWrapper(func, neg_snan_0x42, neg_sNaN));
+ }
}
};
diff --git a/libc/test/src/math/smoke/acos_test.cpp b/libc/test/src/math/smoke/acos_test.cpp
index fe2caefb52ab..2b2fa75b0d7c 100644
--- a/libc/test/src/math/smoke/acos_test.cpp
+++ b/libc/test/src/math/smoke/acos_test.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
-#include "src/__support/libc_errno.h"
#include "src/math/acos.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,10 +18,10 @@ TEST_F(LlvmLibcAcosTest, SpecialNumbers) {
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acos(sNaN),
FE_INVALID);
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acos(aNaN));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(0x1.921fb54442d18p0, LIBC_NAMESPACE::acos(zero));
EXPECT_FP_EQ(0x1.921fb54442d18p0, LIBC_NAMESPACE::acos(neg_zero));
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acos(inf),
FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
diff --git a/libc/test/src/math/smoke/acosf16_test.cpp b/libc/test/src/math/smoke/acosf16_test.cpp
index 7103dc33fec3..6cc170d3fd35 100644
--- a/libc/test/src/math/smoke/acosf16_test.cpp
+++ b/libc/test/src/math/smoke/acosf16_test.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/acosf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,6 @@
using LlvmLibcAcosf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAcosf16Test, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acosf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp
index 733610a03937..e9a90a1d4a7c 100644
--- a/libc/test/src/math/smoke/acosf_test.cpp
+++ b/libc/test/src/math/smoke/acosf_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/acosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,8 +18,6 @@
using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAcosfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acosf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/acoshf16_test.cpp b/libc/test/src/math/smoke/acoshf16_test.cpp
index 6b9c995cf992..b020de40b51e 100644
--- a/libc/test/src/math/smoke/acoshf16_test.cpp
+++ b/libc/test/src/math/smoke/acoshf16_test.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/acoshf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,6 @@
using LlvmLibcAcoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAcoshf16Test, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acoshf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp
index 19556b27e542..6918980da20e 100644
--- a/libc/test/src/math/smoke/acoshf_test.cpp
+++ b/libc/test/src/math/smoke/acoshf_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/acoshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,8 +18,6 @@
using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acoshf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/acospif16_test.cpp b/libc/test/src/math/smoke/acospif16_test.cpp
index 4b2f6de3f7e3..0669d21a8d99 100644
--- a/libc/test/src/math/smoke/acospif16_test.cpp
+++ b/libc/test/src/math/smoke/acospif16_test.cpp
@@ -6,14 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/acospif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
using LlvmLibcAcospif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAcospif16Test, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acospif16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinf16_test.cpp b/libc/test/src/math/smoke/asinf16_test.cpp
index b03f0a420a49..fa118bb497a6 100644
--- a/libc/test/src/math/smoke/asinf16_test.cpp
+++ b/libc/test/src/math/smoke/asinf16_test.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/asinf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,6 @@
using LlvmLibcAsinf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAsinf16Test, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::asinf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp
index 6195a1126694..2135ed33edfa 100644
--- a/libc/test/src/math/smoke/asinf_test.cpp
+++ b/libc/test/src/math/smoke/asinf_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/asinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,8 +18,6 @@
using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAsinfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::asinf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinhf16_test.cpp b/libc/test/src/math/smoke/asinhf16_test.cpp
index 7f612ce3c467..f17300cf980e 100644
--- a/libc/test/src/math/smoke/asinhf16_test.cpp
+++ b/libc/test/src/math/smoke/asinhf16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/asinhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,7 +14,6 @@
using LlvmLibcAsinhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAsinhf16Test, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::asinhf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp
index e6326c116023..d053a5007978 100644
--- a/libc/test/src/math/smoke/asinhf_test.cpp
+++ b/libc/test/src/math/smoke/asinhf_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/asinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,8 +18,6 @@
using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::asinhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/asinpif16_test.cpp b/libc/test/src/math/smoke/asinpif16_test.cpp
index 5303eed8f5da..328da7fb0606 100644
--- a/libc/test/src/math/smoke/asinpif16_test.cpp
+++ b/libc/test/src/math/smoke/asinpif16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/asinpif16.h"
#include "test/UnitTest/FPMatcher.h"
@@ -26,13 +26,12 @@ TEST_F(LlvmLibcAsinpif16Test, SpecialNumbers) {
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(FPBits::signaling_nan().get_val()));
+ EXPECT_MATH_ERRNO(0);
// infinity inputs -> should return NaN
- libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(), LIBC_NAMESPACE::asinpif16(inf));
EXPECT_MATH_ERRNO(EDOM);
- libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(neg_inf));
EXPECT_MATH_ERRNO(EDOM);
@@ -40,29 +39,24 @@ TEST_F(LlvmLibcAsinpif16Test, SpecialNumbers) {
TEST_F(LlvmLibcAsinpif16Test, OutOfRange) {
// Test values > 1
- libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(1.5f16));
EXPECT_MATH_ERRNO(EDOM);
- libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(2.0f16));
EXPECT_MATH_ERRNO(EDOM);
// Test values < -1
- libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(-1.5f16));
EXPECT_MATH_ERRNO(EDOM);
- libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(-2.0f16));
EXPECT_MATH_ERRNO(EDOM);
// Test maximum normal value (should be > 1 for float16)
- libc_errno = 0;
EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
LIBC_NAMESPACE::asinpif16(FPBits::max_normal().get_val()));
EXPECT_MATH_ERRNO(EDOM);
diff --git a/libc/test/src/math/smoke/atan2f_test.cpp b/libc/test/src/math/smoke/atan2f_test.cpp
index 7f8cfb9830d2..83173c674462 100644
--- a/libc/test/src/math/smoke/atan2f_test.cpp
+++ b/libc/test/src/math/smoke/atan2f_test.cpp
@@ -8,7 +8,6 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/atan2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +15,6 @@
using LlvmLibcAtan2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAtan2fTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atan2f(sNaN, sNaN),
FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/atanf16_test.cpp b/libc/test/src/math/smoke/atanf16_test.cpp
index ba1e3b2fc8be..1d56fdb68b4a 100644
--- a/libc/test/src/math/smoke/atanf16_test.cpp
+++ b/libc/test/src/math/smoke/atanf16_test.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
#include "src/math/atanf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,7 +13,6 @@
using LlvmLibcAtanf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAtanf16Test, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::atanf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp
index 7d2dfee7edf3..e983083d0123 100644
--- a/libc/test/src/math/smoke/atanf_test.cpp
+++ b/libc/test/src/math/smoke/atanf_test.cpp
@@ -8,7 +8,6 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/atanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,7 +17,6 @@
using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAtanfTest, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atanf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/atanhf16_test.cpp b/libc/test/src/math/smoke/atanhf16_test.cpp
index c2a520f7638f..a417dddd52d5 100644
--- a/libc/test/src/math/smoke/atanhf16_test.cpp
+++ b/libc/test/src/math/smoke/atanhf16_test.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/atanhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,7 +15,6 @@
using LlvmLibcAtanhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcAtanhf16Test, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf16(sNaN),
FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp
index 5588ae00dece..da15534e1f34 100644
--- a/libc/test/src/math/smoke/atanhf_test.cpp
+++ b/libc/test/src/math/smoke/atanhf_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/atanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -20,7 +20,6 @@ using LIBC_NAMESPACE::Sign;
using LlvmLibcAtanhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atanhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
// TODO: Strengthen errno,exception checks and remove these assert macros
diff --git a/libc/test/src/math/smoke/atanpif16_test.cpp b/libc/test/src/math/smoke/atanpif16_test.cpp
new file mode 100644
index 000000000000..ffc8ad729630
--- /dev/null
+++ b/libc/test/src/math/smoke/atanpif16_test.cpp
@@ -0,0 +1,63 @@
+//===-- Unittests for atanpif16 -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/atanpif16.h"
+#include "test/UnitTest/FPMatcher.h"
+
+using LIBC_NAMESPACE::cpp::array;
+using LlvmLibcAtanpif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
+
+TEST_F(LlvmLibcAtanpif16Test, SpecialNumbers) {
+ // zero
+ EXPECT_FP_EQ(zero, LIBC_NAMESPACE::atanpif16(zero));
+ EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::atanpif16(neg_zero));
+
+ // NaN inputs
+ EXPECT_FP_EQ(FPBits::quiet_nan().get_val(),
+ LIBC_NAMESPACE::atanpif16(FPBits::quiet_nan().get_val()));
+
+ EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::atanpif16(aNaN));
+
+ // infinity inputs -> should return +/-0.5
+ EXPECT_FP_EQ(0.5f16, LIBC_NAMESPACE::atanpif16(inf));
+ EXPECT_FP_EQ(-0.5f16, LIBC_NAMESPACE::atanpif16(neg_inf));
+}
+
+TEST_F(LlvmLibcAtanpif16Test, SymmetryProperty) {
+ // Test that atanpi(-x) = -atanpi(x)
+ constexpr array<float16, 12> TEST_VALS = {
+ 0.1f16, 0.25f16, 0.5f16, 0.75f16, 1.0f16, 1.5f16,
+ 2.0f16, 5.0f16, 10.0f16, 50.0f16, 100.0f16, 1000.0f16};
+
+ for (float16 x : TEST_VALS) {
+ FPBits neg_x_bits(x);
+ neg_x_bits.set_sign(Sign::NEG);
+ float16 neg_x = neg_x_bits.get_val();
+
+ float16 pos_result = LIBC_NAMESPACE::atanpif16(x);
+ float16 neg_result = LIBC_NAMESPACE::atanpif16(neg_x);
+
+ EXPECT_FP_EQ(pos_result, FPBits(neg_result).abs().get_val());
+ }
+}
+
+TEST_F(LlvmLibcAtanpif16Test, MonotonicityProperty) {
+ // Test that atanpi is monotonically increasing
+ constexpr array<float16, 15> TEST_VALS = {
+ -1000.0f16, -100.0f16, -10.0f16, -2.0f16, -1.0f16,
+ -0.5f16, -0.1f16, 0.0f16, 0.1f16, 0.5f16,
+ 1.0f16, 2.0f16, 10.0f16, 100.0f16, 1000.0f16};
+ for (size_t i = 0; i < TEST_VALS.size() - 1; ++i) {
+ float16 x1 = TEST_VALS[i];
+ float16 x2 = TEST_VALS[i + 1];
+ float16 result1 = LIBC_NAMESPACE::atanpif16(x1);
+ float16 result2 = LIBC_NAMESPACE::atanpif16(x2);
+
+ EXPECT_TRUE(result1 < result2);
+ }
+}
diff --git a/libc/test/src/math/smoke/canonicalizebf16_test.cpp b/libc/test/src/math/smoke/canonicalizebf16_test.cpp
new file mode 100644
index 000000000000..bf955c26ebc4
--- /dev/null
+++ b/libc/test/src/math/smoke/canonicalizebf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for canonicalizebf16 ------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "CanonicalizeTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/canonicalizebf16.h"
+
+LIST_CANONICALIZE_TESTS(bfloat16, LIBC_NAMESPACE::canonicalizebf16)
diff --git a/libc/test/src/math/smoke/copysignbf16_test.cpp b/libc/test/src/math/smoke/copysignbf16_test.cpp
new file mode 100644
index 000000000000..71a97e37a749
--- /dev/null
+++ b/libc/test/src/math/smoke/copysignbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for copysignbf16 ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "CopySignTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/copysignbf16.h"
+
+LIST_COPYSIGN_TESTS(bfloat16, LIBC_NAMESPACE::copysignbf16)
diff --git a/libc/test/src/math/smoke/cosf16_test.cpp b/libc/test/src/math/smoke/cosf16_test.cpp
index 4362a5a3a4bd..0bd228c4f05d 100644
--- a/libc/test/src/math/smoke/cosf16_test.cpp
+++ b/libc/test/src/math/smoke/cosf16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/cosf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,8 +14,6 @@
using LlvmLibcCosf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcCosf16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cosf16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/cosf_test.cpp b/libc/test/src/math/smoke/cosf_test.cpp
index 837fee9aadfa..0236c4148109 100644
--- a/libc/test/src/math/smoke/cosf_test.cpp
+++ b/libc/test/src/math/smoke/cosf_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/cosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +17,6 @@
using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcCosfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cosf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/coshf16_test.cpp b/libc/test/src/math/smoke/coshf16_test.cpp
index 7bf62afa24c4..6d5824d37daf 100644
--- a/libc/test/src/math/smoke/coshf16_test.cpp
+++ b/libc/test/src/math/smoke/coshf16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/coshf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcCoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcCoshf16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::coshf16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,8 +38,6 @@ TEST_F(LlvmLibcCoshf16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcCoshf16Test, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::coshf16(max_normal),
FE_OVERFLOW | FE_INEXACT);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp
index 81096faaf815..f73737f90807 100644
--- a/libc/test/src/math/smoke/coshf_test.cpp
+++ b/libc/test/src/math/smoke/coshf_test.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/coshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,8 +18,6 @@
using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::coshf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -40,7 +38,6 @@ TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcCoshfTest, Overflow) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::coshf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/cospif16_test.cpp b/libc/test/src/math/smoke/cospif16_test.cpp
index fcde0cc79e35..dadf0cf7b553 100644
--- a/libc/test/src/math/smoke/cospif16_test.cpp
+++ b/libc/test/src/math/smoke/cospif16_test.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/cospif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,8 +15,6 @@
using LlvmLibcCospif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcCospif16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cospif16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/cospif_test.cpp b/libc/test/src/math/smoke/cospif_test.cpp
index 6f1bb24b4ec3..b9cb261a63a8 100644
--- a/libc/test/src/math/smoke/cospif_test.cpp
+++ b/libc/test/src/math/smoke/cospif_test.cpp
@@ -6,16 +6,14 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/stdint_proxy.h"
-#include "src/__support/libc_errno.h"
#include "src/math/cospif.h"
#include "test/UnitTest/FPMatcher.h"
using LlvmLibcCospifTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcCospifTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cospif(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/exp10_test.cpp b/libc/test/src/math/smoke/exp10_test.cpp
index 76e6c7844c12..8f564de817f4 100644
--- a/libc/test/src/math/smoke/exp10_test.cpp
+++ b/libc/test/src/math/smoke/exp10_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,12 +21,19 @@ TEST_F(LlvmLibcExp10Test, SpecialNumbers) {
EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10(aNaN));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp10(neg_inf));
+ EXPECT_MATH_ERRNO(0);
+
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10(-0x1.0p20),
FE_UNDERFLOW);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10(0x1.0p20),
FE_OVERFLOW);
+ EXPECT_MATH_ERRNO(ERANGE);
+
EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(0.0));
EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(-0.0));
diff --git a/libc/test/src/math/smoke/exp10f16_test.cpp b/libc/test/src/math/smoke/exp10f16_test.cpp
index bda40348f883..c2dffd1be067 100644
--- a/libc/test/src/math/smoke/exp10f16_test.cpp
+++ b/libc/test/src/math/smoke/exp10f16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp10f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcExp10f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExp10f16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp10f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,8 +38,6 @@ TEST_F(LlvmLibcExp10f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10f16Test, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10f16(max_normal),
FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -53,8 +49,6 @@ TEST_F(LlvmLibcExp10f16Test, Overflow) {
}
TEST_F(LlvmLibcExp10f16Test, Underflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10f16(neg_max_normal),
FE_UNDERFLOW | FE_INEXACT);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/exp10f_test.cpp b/libc/test/src/math/smoke/exp10f_test.cpp
index cf2f976958e2..8d7c1714bcfd 100644
--- a/libc/test/src/math/smoke/exp10f_test.cpp
+++ b/libc/test/src/math/smoke/exp10f_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp10f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +17,6 @@
using LlvmLibcExp10fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp10f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -43,7 +41,6 @@ TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10fTest, Overflow) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::exp10f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/exp10m1f16_test.cpp b/libc/test/src/math/smoke/exp10m1f16_test.cpp
index ed2d5a48b316..1ba0e4c2effc 100644
--- a/libc/test/src/math/smoke/exp10m1f16_test.cpp
+++ b/libc/test/src/math/smoke/exp10m1f16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp10m1f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcExp10m1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExp10m1f16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp10m1f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,8 +38,6 @@ TEST_F(LlvmLibcExp10m1f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10m1f16Test, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10m1f16(max_normal),
FE_OVERFLOW | FE_INEXACT);
EXPECT_MATH_ERRNO(ERANGE);
@@ -67,8 +63,6 @@ TEST_F(LlvmLibcExp10m1f16Test, Overflow) {
}
TEST_F(LlvmLibcExp10m1f16Test, ResultNearNegOne) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(-1.0),
LIBC_NAMESPACE::exp10m1f16(neg_max_normal),
FE_INEXACT);
diff --git a/libc/test/src/math/smoke/exp10m1f_test.cpp b/libc/test/src/math/smoke/exp10m1f_test.cpp
index 19369a897aaa..87320fa2fe2f 100644
--- a/libc/test/src/math/smoke/exp10m1f_test.cpp
+++ b/libc/test/src/math/smoke/exp10m1f_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/exp10m1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,8 +14,6 @@
using LlvmLibcExp10m1fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExp10m1fTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp10m1f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -34,8 +32,6 @@ TEST_F(LlvmLibcExp10m1fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp10m1fTest, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10m1f(0x1.fffffep+127f),
FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -50,8 +46,6 @@ TEST_F(LlvmLibcExp10m1fTest, Overflow) {
}
TEST_F(LlvmLibcExp10m1fTest, Underflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0f, LIBC_NAMESPACE::exp10m1f(-max_normal),
FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/exp2_test.cpp b/libc/test/src/math/smoke/exp2_test.cpp
index 3d26df1ee710..3fd732b790f6 100644
--- a/libc/test/src/math/smoke/exp2_test.cpp
+++ b/libc/test/src/math/smoke/exp2_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,11 +21,18 @@ TEST_F(LlvmLibcExp2Test, SpecialNumbers) {
EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2(aNaN));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp2(neg_inf));
+ EXPECT_MATH_ERRNO(0);
+
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2(-0x1.0p20),
FE_UNDERFLOW);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2(0x1.0p20), FE_OVERFLOW);
+ EXPECT_MATH_ERRNO(ERANGE);
+
EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(0.0));
EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(-0.0));
EXPECT_FP_EQ_ALL_ROUNDING(2.0, LIBC_NAMESPACE::exp2(1.0));
diff --git a/libc/test/src/math/smoke/exp2f16_test.cpp b/libc/test/src/math/smoke/exp2f16_test.cpp
index 1eb7343dcd22..31226292b880 100644
--- a/libc/test/src/math/smoke/exp2f16_test.cpp
+++ b/libc/test/src/math/smoke/exp2f16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp2f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcExp2f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExp2f16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp2f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,8 +38,6 @@ TEST_F(LlvmLibcExp2f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2f16Test, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2f16(max_normal),
FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -53,8 +49,6 @@ TEST_F(LlvmLibcExp2f16Test, Overflow) {
}
TEST_F(LlvmLibcExp2f16Test, Underflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2f16(neg_max_normal),
FE_UNDERFLOW | FE_INEXACT);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp
index 12bcbec78430..2adfa5fc9040 100644
--- a/libc/test/src/math/smoke/exp2f_test.cpp
+++ b/libc/test/src/math/smoke/exp2f_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +17,6 @@
using LlvmLibcExp2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp2f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -44,7 +42,6 @@ TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2fTest, Overflow) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::exp2f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/exp2m1f16_test.cpp b/libc/test/src/math/smoke/exp2m1f16_test.cpp
index 635b7a6e187d..4917128c7f64 100644
--- a/libc/test/src/math/smoke/exp2m1f16_test.cpp
+++ b/libc/test/src/math/smoke/exp2m1f16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp2m1f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcExp2m1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExp2m1f16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp2m1f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -39,8 +37,6 @@ TEST_F(LlvmLibcExp2m1f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2m1f16Test, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2m1f16(max_normal),
FE_OVERFLOW | FE_INEXACT);
EXPECT_MATH_ERRNO(ERANGE);
@@ -65,8 +61,6 @@ TEST_F(LlvmLibcExp2m1f16Test, Overflow) {
}
TEST_F(LlvmLibcExp2m1f16Test, ResultNearNegOne) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0, LIBC_NAMESPACE::exp2m1f16(neg_max_normal),
FE_INEXACT);
diff --git a/libc/test/src/math/smoke/exp2m1f_test.cpp b/libc/test/src/math/smoke/exp2m1f_test.cpp
index 63852e11655a..e847cd09f34d 100644
--- a/libc/test/src/math/smoke/exp2m1f_test.cpp
+++ b/libc/test/src/math/smoke/exp2m1f_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/exp2m1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@ using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode;
using LIBC_NAMESPACE::fputil::testing::RoundingMode;
TEST_F(LlvmLibcExp2m1fTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp2m1f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -34,8 +32,6 @@ TEST_F(LlvmLibcExp2m1fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExp2m1fTest, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2m1f(0x1.fffffep+127),
FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -50,8 +46,6 @@ TEST_F(LlvmLibcExp2m1fTest, Overflow) {
}
TEST_F(LlvmLibcExp2m1fTest, Underflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0f, LIBC_NAMESPACE::exp2m1f(-0x1.fffffep+127),
FE_UNDERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/exp_test.cpp b/libc/test/src/math/smoke/exp_test.cpp
index 4ce322736534..939727748ca0 100644
--- a/libc/test/src/math/smoke/exp_test.cpp
+++ b/libc/test/src/math/smoke/exp_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/exp.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,11 +21,18 @@ TEST_F(LlvmLibcExpTest, SpecialNumbers) {
EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp(aNaN));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp(neg_inf));
+ EXPECT_MATH_ERRNO(0);
+
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp(-0x1.0p20),
FE_UNDERFLOW);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp(0x1.0p20), FE_OVERFLOW);
+ EXPECT_MATH_ERRNO(ERANGE);
+
EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(0.0));
EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(-0.0));
}
diff --git a/libc/test/src/math/smoke/expf16_test.cpp b/libc/test/src/math/smoke/expf16_test.cpp
index 863f694ffc41..85988c551878 100644
--- a/libc/test/src/math/smoke/expf16_test.cpp
+++ b/libc/test/src/math/smoke/expf16_test.cpp
@@ -9,7 +9,6 @@
#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/expf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +16,6 @@
using LlvmLibcExpf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExpf16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expf16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -41,8 +38,6 @@ TEST_F(LlvmLibcExpf16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExpf16Test, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::expf16(max_normal),
FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
@@ -54,8 +49,6 @@ TEST_F(LlvmLibcExpf16Test, Overflow) {
}
TEST_F(LlvmLibcExpf16Test, Underflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::expf16(neg_max_normal),
FE_UNDERFLOW | FE_INEXACT);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/expf_test.cpp b/libc/test/src/math/smoke/expf_test.cpp
index a0e785f80a1d..ca5bc5961920 100644
--- a/libc/test/src/math/smoke/expf_test.cpp
+++ b/libc/test/src/math/smoke/expf_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/expf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +17,6 @@
using LlvmLibcExpfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::expf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -39,7 +37,6 @@ TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExpfTest, Overflow) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::expf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/expm1_test.cpp b/libc/test/src/math/smoke/expm1_test.cpp
index db7149dc7ae5..7d605c0d5b3d 100644
--- a/libc/test/src/math/smoke/expm1_test.cpp
+++ b/libc/test/src/math/smoke/expm1_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/expm1.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,10 +21,16 @@ TEST_F(LlvmLibcExpm1Test, SpecialNumbers) {
EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expm1(aNaN));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::expm1(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ_ALL_ROUNDING(-1.0, LIBC_NAMESPACE::expm1(neg_inf));
+ EXPECT_MATH_ERRNO(0);
+
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::expm1(0x1.0p20),
FE_OVERFLOW);
+ EXPECT_MATH_ERRNO(ERANGE);
+
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::expm1(zero));
EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, LIBC_NAMESPACE::expm1(neg_zero));
// |x| < 2^-53, expm1(x) = x
diff --git a/libc/test/src/math/smoke/expm1f16_test.cpp b/libc/test/src/math/smoke/expm1f16_test.cpp
index 4d19a9bac5eb..545304ced63e 100644
--- a/libc/test/src/math/smoke/expm1f16_test.cpp
+++ b/libc/test/src/math/smoke/expm1f16_test.cpp
@@ -9,7 +9,6 @@
#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/expm1f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +16,6 @@
using LlvmLibcExpm1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcExpm1f16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expm1f16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,8 +37,6 @@ TEST_F(LlvmLibcExpm1f16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcExpm1f16Test, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::expm1f16(max_normal),
FE_OVERFLOW | FE_INEXACT);
EXPECT_MATH_ERRNO(ERANGE);
@@ -67,8 +62,6 @@ TEST_F(LlvmLibcExpm1f16Test, Overflow) {
}
TEST_F(LlvmLibcExpm1f16Test, ResultNearNegOne) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(-1.0),
LIBC_NAMESPACE::expm1f16(neg_max_normal),
FE_INEXACT);
diff --git a/libc/test/src/math/smoke/expm1f_test.cpp b/libc/test/src/math/smoke/expm1f_test.cpp
index 9482bf6fd4b0..e923d5b09e08 100644
--- a/libc/test/src/math/smoke/expm1f_test.cpp
+++ b/libc/test/src/math/smoke/expm1f_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/expm1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +17,6 @@
using LlvmLibcExpm1fTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::expm1f(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -39,7 +37,6 @@ TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
}
TEST_F(LlvmLibcExpm1fTest, Overflow) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::expm1f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/fdimbf16_test.cpp b/libc/test/src/math/smoke/fdimbf16_test.cpp
new file mode 100644
index 000000000000..43e8039053fd
--- /dev/null
+++ b/libc/test/src/math/smoke/fdimbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for fdimbf16 --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "FDimTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/fdimbf16.h"
+
+LIST_FDIM_TESTS(bfloat16, LIBC_NAMESPACE::fdimbf16);
diff --git a/libc/test/src/math/smoke/fmodbf16_test.cpp b/libc/test/src/math/smoke/fmodbf16_test.cpp
new file mode 100644
index 000000000000..8f30941c89b6
--- /dev/null
+++ b/libc/test/src/math/smoke/fmodbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for fmodbf16 --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "FModTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/fmodbf16.h"
+
+LIST_FMOD_TESTS(bfloat16, LIBC_NAMESPACE::fmodbf16)
diff --git a/libc/test/src/math/smoke/frexpbf16_test.cpp b/libc/test/src/math/smoke/frexpbf16_test.cpp
new file mode 100644
index 000000000000..3c80edbb433b
--- /dev/null
+++ b/libc/test/src/math/smoke/frexpbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for frexpbf16 -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "FrexpTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/frexpbf16.h"
+
+LIST_FREXP_TESTS(bfloat16, LIBC_NAMESPACE::frexpbf16);
diff --git a/libc/test/src/math/smoke/ilogbbf16_test.cpp b/libc/test/src/math/smoke/ilogbbf16_test.cpp
new file mode 100644
index 000000000000..d9fa03a2e50c
--- /dev/null
+++ b/libc/test/src/math/smoke/ilogbbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for ilogbbf16 -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "ILogbTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/ilogbbf16.h"
+
+LIST_INTLOGB_TESTS(int, bfloat16, LIBC_NAMESPACE::ilogbbf16);
diff --git a/libc/test/src/math/smoke/iscanonicalbf16_test.cpp b/libc/test/src/math/smoke/iscanonicalbf16_test.cpp
new file mode 100644
index 000000000000..3d735882e82a
--- /dev/null
+++ b/libc/test/src/math/smoke/iscanonicalbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for iscanonicalbf16 -------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "IsCanonicalTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/iscanonicalbf16.h"
+
+LIST_ISCANONICAL_TESTS(bfloat16, LIBC_NAMESPACE::iscanonicalbf16)
diff --git a/libc/test/src/math/smoke/issignalingbf16_test.cpp b/libc/test/src/math/smoke/issignalingbf16_test.cpp
new file mode 100644
index 000000000000..ed7e5af4aa41
--- /dev/null
+++ b/libc/test/src/math/smoke/issignalingbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for issignalingbf16 -------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "IsSignalingTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/issignalingbf16.h"
+
+LIST_ISSIGNALING_TESTS(bfloat16, LIBC_NAMESPACE::issignalingbf16)
diff --git a/libc/test/src/math/smoke/ldexpbf16_test.cpp b/libc/test/src/math/smoke/ldexpbf16_test.cpp
new file mode 100644
index 000000000000..2e57eb8460c9
--- /dev/null
+++ b/libc/test/src/math/smoke/ldexpbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for ldexpbf16 -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "LdExpTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/ldexpbf16.h"
+
+LIST_LDEXP_TESTS(bfloat16, LIBC_NAMESPACE::ldexpbf16);
diff --git a/libc/test/src/math/smoke/llogbbf16_test.cpp b/libc/test/src/math/smoke/llogbbf16_test.cpp
new file mode 100644
index 000000000000..4454fbfb0644
--- /dev/null
+++ b/libc/test/src/math/smoke/llogbbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for llogbbf16 -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "ILogbTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/llogbbf16.h"
+
+LIST_INTLOGB_TESTS(long, bfloat16, LIBC_NAMESPACE::llogbbf16);
diff --git a/libc/test/src/math/smoke/log10_test.cpp b/libc/test/src/math/smoke/log10_test.cpp
index 3af27d47437a..ab7fc178e2d0 100644
--- a/libc/test/src/math/smoke/log10_test.cpp
+++ b/libc/test/src/math/smoke/log10_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/log10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -22,12 +22,18 @@ TEST_F(LlvmLibcLog10Test, SpecialNumbers) {
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10(aNaN));
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10(inf));
+ EXPECT_MATH_ERRNO(0);
+
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(neg_inf), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(0.0),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(-0.0),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(-1.0), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10(1.0));
double x = 1.0;
diff --git a/libc/test/src/math/smoke/log10f16_test.cpp b/libc/test/src/math/smoke/log10f16_test.cpp
index 53f5ac46aa60..0e8d054cbbb8 100644
--- a/libc/test/src/math/smoke/log10f16_test.cpp
+++ b/libc/test/src/math/smoke/log10f16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/log10f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcLog10f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcLog10f16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::log10f16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/log10f_test.cpp b/libc/test/src/math/smoke/log10f_test.cpp
index f15da755c17e..a8b4bd0e72fd 100644
--- a/libc/test/src/math/smoke/log10f_test.cpp
+++ b/libc/test/src/math/smoke/log10f_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
@@ -21,12 +22,19 @@ TEST_F(LlvmLibcLog10fTest, SpecialNumbers) {
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10f(aNaN));
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10f(inf));
+ EXPECT_MATH_ERRNO(0);
+
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(neg_inf), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(0.0f),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(-0.0f),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(-1.0f), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
+
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10f(1.0f));
float x = 1.0f;
diff --git a/libc/test/src/math/smoke/log1p_test.cpp b/libc/test/src/math/smoke/log1p_test.cpp
index 61c56cd2c6dd..3b9dd0558ba6 100644
--- a/libc/test/src/math/smoke/log1p_test.cpp
+++ b/libc/test/src/math/smoke/log1p_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/log1p.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -21,12 +21,16 @@ TEST_F(LlvmLibcLog1pTest, SpecialNumbers) {
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1p(aNaN));
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1p(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(neg_inf), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(-2.0), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1p(0.0));
EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1p(-0.0));
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1p(-1.0),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ(0x1.62c829bf8fd9dp9,
LIBC_NAMESPACE::log1p(0x1.9b536cac3a09dp1023));
diff --git a/libc/test/src/math/smoke/log1pf_test.cpp b/libc/test/src/math/smoke/log1pf_test.cpp
index 82c2f9465f4f..6fbeb62bfa59 100644
--- a/libc/test/src/math/smoke/log1pf_test.cpp
+++ b/libc/test/src/math/smoke/log1pf_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/log1pf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -22,11 +22,14 @@ TEST_F(LlvmLibcLog1pfTest, SpecialNumbers) {
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1pf(aNaN));
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1pf(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1pf(neg_inf), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1pf(0.0f));
EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1pf(-0.0f));
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1pf(-1.0f),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
}
#ifdef LIBC_TEST_FTZ_DAZ
diff --git a/libc/test/src/math/smoke/log2_test.cpp b/libc/test/src/math/smoke/log2_test.cpp
index 6bf1ce3249a6..8adf81f7a700 100644
--- a/libc/test/src/math/smoke/log2_test.cpp
+++ b/libc/test/src/math/smoke/log2_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/log2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -22,11 +22,16 @@ TEST_F(LlvmLibcLog2Test, SpecialNumbers) {
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2(aNaN));
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(neg_inf), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(0.0), FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(-0.0),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(-1.0), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2(1.0));
}
diff --git a/libc/test/src/math/smoke/log2f16_test.cpp b/libc/test/src/math/smoke/log2f16_test.cpp
index fd20652d2f00..abefc67963c1 100644
--- a/libc/test/src/math/smoke/log2f16_test.cpp
+++ b/libc/test/src/math/smoke/log2f16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/log2f16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcLog2f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcLog2f16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::log2f16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/log2f_test.cpp b/libc/test/src/math/smoke/log2f_test.cpp
index 80e13a2374ad..56a46a5ad9a3 100644
--- a/libc/test/src/math/smoke/log2f_test.cpp
+++ b/libc/test/src/math/smoke/log2f_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/log2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -22,12 +22,17 @@ TEST_F(LlvmLibcLog2fTest, SpecialNumbers) {
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2f(aNaN));
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2f(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(neg_inf), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(0.0f),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(-0.0f),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(-1.0f), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2f(1.0f));
}
#ifdef LIBC_TEST_FTZ_DAZ
diff --git a/libc/test/src/math/smoke/log_test.cpp b/libc/test/src/math/smoke/log_test.cpp
index 1d7761a56803..192e6c8f87e3 100644
--- a/libc/test/src/math/smoke/log_test.cpp
+++ b/libc/test/src/math/smoke/log_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/log.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -22,10 +22,15 @@ TEST_F(LlvmLibcLogTest, SpecialNumbers) {
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log(aNaN));
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(neg_inf), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(0.0), FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(-0.0), FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(-1.0), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log(1.0));
}
diff --git a/libc/test/src/math/smoke/logbbf16_test.cpp b/libc/test/src/math/smoke/logbbf16_test.cpp
new file mode 100644
index 000000000000..4ceec3d6984d
--- /dev/null
+++ b/libc/test/src/math/smoke/logbbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for logbbf16 --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "LogbTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/logbbf16.h"
+
+LIST_LOGB_TESTS(bfloat16, LIBC_NAMESPACE::logbbf16)
diff --git a/libc/test/src/math/smoke/logf16_test.cpp b/libc/test/src/math/smoke/logf16_test.cpp
index 2784f3d5fa54..a8332c624c74 100644
--- a/libc/test/src/math/smoke/logf16_test.cpp
+++ b/libc/test/src/math/smoke/logf16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/logf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcLogf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcLogf16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::logf16(aNaN));
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/logf_test.cpp b/libc/test/src/math/smoke/logf_test.cpp
index f58209e26f05..893d89da9d44 100644
--- a/libc/test/src/math/smoke/logf_test.cpp
+++ b/libc/test/src/math/smoke/logf_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
@@ -21,12 +22,17 @@ TEST_F(LlvmLibcLogfTest, SpecialNumbers) {
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::logf(aNaN));
EXPECT_FP_EQ(inf, LIBC_NAMESPACE::logf(inf));
+ EXPECT_MATH_ERRNO(0);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(neg_inf), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(0.0f),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(-0.0f),
FE_DIVBYZERO);
+ EXPECT_MATH_ERRNO(ERANGE);
EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(-1.0f), FE_INVALID);
+ EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::logf(1.0f));
}
#ifdef LIBC_TEST_FTZ_DAZ
diff --git a/libc/test/src/math/smoke/modfbf16_test.cpp b/libc/test/src/math/smoke/modfbf16_test.cpp
new file mode 100644
index 000000000000..88ebed55222c
--- /dev/null
+++ b/libc/test/src/math/smoke/modfbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for modfbf16 --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "ModfTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/modfbf16.h"
+
+LIST_MODF_TESTS(bfloat16, LIBC_NAMESPACE::modfbf16)
diff --git a/libc/test/src/math/smoke/remquobf16_test.cpp b/libc/test/src/math/smoke/remquobf16_test.cpp
new file mode 100644
index 000000000000..3f754bbd28a4
--- /dev/null
+++ b/libc/test/src/math/smoke/remquobf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for remquobf16 ------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "RemQuoTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/remquobf16.h"
+
+LIST_REMQUO_TESTS(bfloat16, LIBC_NAMESPACE::remquobf16)
diff --git a/libc/test/src/math/smoke/scalblnbf16_test.cpp b/libc/test/src/math/smoke/scalblnbf16_test.cpp
new file mode 100644
index 000000000000..c6fc3aac5e74
--- /dev/null
+++ b/libc/test/src/math/smoke/scalblnbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for scalblnbf16 -----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "ScalbnTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/scalblnbf16.h"
+
+LIST_SCALBN_TESTS(bfloat16, long, LIBC_NAMESPACE::scalblnbf16)
diff --git a/libc/test/src/math/smoke/scalbnbf16_test.cpp b/libc/test/src/math/smoke/scalbnbf16_test.cpp
new file mode 100644
index 000000000000..855fd75e6e8f
--- /dev/null
+++ b/libc/test/src/math/smoke/scalbnbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for scalbnbf16 ------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "ScalbnTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/scalbnbf16.h"
+
+LIST_SCALBN_TESTS(bfloat16, int, LIBC_NAMESPACE::scalbnbf16)
diff --git a/libc/test/src/math/smoke/sincos_test.cpp b/libc/test/src/math/smoke/sincos_test.cpp
index 8bc584de4e8c..a98b9319b562 100644
--- a/libc/test/src/math/smoke/sincos_test.cpp
+++ b/libc/test/src/math/smoke/sincos_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "src/math/sincos.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -35,10 +36,12 @@ TEST_F(LlvmLibcSincosTest, SpecialNumbers) {
LIBC_NAMESPACE::sincos(inf, &sin_x, &cos_x);
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, cos_x);
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, sin_x);
+ EXPECT_MATH_ERRNO(EDOM);
LIBC_NAMESPACE::sincos(neg_inf, &sin_x, &cos_x);
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, cos_x);
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, sin_x);
+ EXPECT_MATH_ERRNO(EDOM);
LIBC_NAMESPACE::sincos(0x1.0p-28, &sin_x, &cos_x);
EXPECT_FP_EQ(1.0, cos_x);
diff --git a/libc/test/src/math/smoke/sincosf_test.cpp b/libc/test/src/math/smoke/sincosf_test.cpp
index 7ff0ba7cdefc..f39a11213dc2 100644
--- a/libc/test/src/math/smoke/sincosf_test.cpp
+++ b/libc/test/src/math/smoke/sincosf_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/sincosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,7 +17,6 @@
using LlvmLibcSinCosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcSinCosfTest, SpecialNumbers) {
- libc_errno = 0;
float sin, cos;
LIBC_NAMESPACE::sincosf(sNaN, &sin, &cos);
diff --git a/libc/test/src/math/smoke/sinf16_test.cpp b/libc/test/src/math/smoke/sinf16_test.cpp
index 6b168ac040db..9924f35479e2 100644
--- a/libc/test/src/math/smoke/sinf16_test.cpp
+++ b/libc/test/src/math/smoke/sinf16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/sinf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,8 +14,6 @@
using LlvmLibcSinf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcSinf16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinf16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp
index 8ba66ed4a807..b0ba81e650d4 100644
--- a/libc/test/src/math/smoke/sinf_test.cpp
+++ b/libc/test/src/math/smoke/sinf_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/sinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +17,6 @@
using LlvmLibcSinfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcSinfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/sinhf16_test.cpp b/libc/test/src/math/smoke/sinhf16_test.cpp
index d52739a9adb3..1cbf19c5d3a0 100644
--- a/libc/test/src/math/smoke/sinhf16_test.cpp
+++ b/libc/test/src/math/smoke/sinhf16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/sinhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcSinhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcSinhf16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::sinhf16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -38,8 +36,6 @@ TEST_F(LlvmLibcSinhf16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcSinhf16Test, Overflow) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::sinhf16(max_normal),
FE_OVERFLOW | FE_INEXACT);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp
index 5976a1f16944..8121ccba5442 100644
--- a/libc/test/src/math/smoke/sinhf_test.cpp
+++ b/libc/test/src/math/smoke/sinhf_test.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/sinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -18,8 +18,6 @@
using LlvmLibcSinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcSinhfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
@@ -51,7 +49,6 @@ TEST_F(LlvmLibcSinhfTest, SmallValues) {
}
TEST_F(LlvmLibcSinhfTest, Overflow) {
- libc_errno = 0;
EXPECT_FP_EQ_WITH_EXCEPTION(
inf, LIBC_NAMESPACE::sinhf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
diff --git a/libc/test/src/math/smoke/sinpif16_test.cpp b/libc/test/src/math/smoke/sinpif16_test.cpp
index 9edf2cc663d4..0b4ec915a5ce 100644
--- a/libc/test/src/math/smoke/sinpif16_test.cpp
+++ b/libc/test/src/math/smoke/sinpif16_test.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/sinpif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,8 +15,6 @@
using LlvmLibcSinpif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcSinpif16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinpif16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/sinpif_test.cpp b/libc/test/src/math/smoke/sinpif_test.cpp
index 4a725e02ffec..ca2cac50db27 100644
--- a/libc/test/src/math/smoke/sinpif_test.cpp
+++ b/libc/test/src/math/smoke/sinpif_test.cpp
@@ -6,16 +6,14 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/stdint_proxy.h"
-#include "src/__support/libc_errno.h"
#include "src/math/sinpif.h"
#include "test/UnitTest/FPMatcher.h"
using LlvmLibcSinpifTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcSinpifTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::sinpif(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/sqrtbf16_test.cpp b/libc/test/src/math/smoke/sqrtbf16_test.cpp
new file mode 100644
index 000000000000..25629347fee3
--- /dev/null
+++ b/libc/test/src/math/smoke/sqrtbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for sqrtbf16 --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "SqrtTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/sqrtbf16.h"
+
+LIST_SQRT_TESTS(bfloat16, LIBC_NAMESPACE::sqrtbf16);
diff --git a/libc/test/src/math/smoke/tanf16_test.cpp b/libc/test/src/math/smoke/tanf16_test.cpp
index 95d200cf5591..a29f21aeb1b0 100644
--- a/libc/test/src/math/smoke/tanf16_test.cpp
+++ b/libc/test/src/math/smoke/tanf16_test.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/tanf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -15,8 +15,6 @@
using LlvmLibcTanf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcTanf16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanf16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanf_test.cpp b/libc/test/src/math/smoke/tanf_test.cpp
index c85907c835f0..a1bffad6f7d9 100644
--- a/libc/test/src/math/smoke/tanf_test.cpp
+++ b/libc/test/src/math/smoke/tanf_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/tanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +17,6 @@
using LlvmLibcTanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcTanfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanhf16_test.cpp b/libc/test/src/math/smoke/tanhf16_test.cpp
index eb90f02a8d7c..e00cb0a53650 100644
--- a/libc/test/src/math/smoke/tanhf16_test.cpp
+++ b/libc/test/src/math/smoke/tanhf16_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/cast.h"
-#include "src/__support/libc_errno.h"
#include "src/math/tanhf16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -16,8 +16,6 @@
using LlvmLibcTanhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcTanhf16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::tanhf16(aNaN));
EXPECT_MATH_ERRNO(0);
@@ -40,8 +38,6 @@ TEST_F(LlvmLibcTanhf16Test, SpecialNumbers) {
}
TEST_F(LlvmLibcTanhf16Test, ResultNearBounds) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(1.0),
LIBC_NAMESPACE::tanhf16(max_normal), FE_INEXACT);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp
index 57c05735c543..a887a99f367c 100644
--- a/libc/test/src/math/smoke/tanhf_test.cpp
+++ b/libc/test/src/math/smoke/tanhf_test.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
+#include "hdr/errno_macros.h"
#include "hdr/math_macros.h"
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/libc_errno.h"
#include "src/math/tanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -17,8 +17,6 @@
using LlvmLibcTanhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcTanhfTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanhf(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanpif16_test.cpp b/libc/test/src/math/smoke/tanpif16_test.cpp
index ea896d7bb3e5..b005dfb92ed2 100644
--- a/libc/test/src/math/smoke/tanpif16_test.cpp
+++ b/libc/test/src/math/smoke/tanpif16_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/tanpif16.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,8 +14,6 @@
using LlvmLibcTanpif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
TEST_F(LlvmLibcTanpif16Test, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanpif16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/tanpif_test.cpp b/libc/test/src/math/smoke/tanpif_test.cpp
index e122f57a2fe0..0504c9a7bf81 100644
--- a/libc/test/src/math/smoke/tanpif_test.cpp
+++ b/libc/test/src/math/smoke/tanpif_test.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/libc_errno.h"
+#include "hdr/errno_macros.h"
#include "src/math/tanpif.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -14,8 +14,6 @@
using LlvmLibcTanpifTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcTanpifTest, SpecialNumbers) {
- libc_errno = 0;
-
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tanpif(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
diff --git a/libc/test/src/math/smoke/totalorderbf16_test.cpp b/libc/test/src/math/smoke/totalorderbf16_test.cpp
new file mode 100644
index 000000000000..11aeeac0c52d
--- /dev/null
+++ b/libc/test/src/math/smoke/totalorderbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for totalorderbf16 --------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "TotalOrderTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/totalorderbf16.h"
+
+LIST_TOTALORDER_TESTS(bfloat16, LIBC_NAMESPACE::totalorderbf16)
diff --git a/libc/test/src/math/smoke/totalordermagbf16_test.cpp b/libc/test/src/math/smoke/totalordermagbf16_test.cpp
new file mode 100644
index 000000000000..b5a5a1b7d6c5
--- /dev/null
+++ b/libc/test/src/math/smoke/totalordermagbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for totalordermagbf16 -----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "TotalOrderMagTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/totalordermagbf16.h"
+
+LIST_TOTALORDERMAG_TESTS(bfloat16, LIBC_NAMESPACE::totalordermagbf16)