[libc-commits] [libc] 84c899b - [libc][math] Extract non-MPFR math tests into libc-math-smoke-tests.

Tue Ly via libc-commits libc-commits at lists.llvm.org
Tue Sep 19 09:11:08 PDT 2023


Author: Tue Ly
Date: 2023-09-19T12:10:21-04:00
New Revision: 84c899b2350f95ab4d1a335158363d2c112029ba

URL: https://github.com/llvm/llvm-project/commit/84c899b2350f95ab4d1a335158363d2c112029ba
DIFF: https://github.com/llvm/llvm-project/commit/84c899b2350f95ab4d1a335158363d2c112029ba.diff

LOG: [libc][math] Extract non-MPFR math tests into libc-math-smoke-tests.

Extract non-MPFR math tests into libc-math-smoke-tests.

Reviewed By: sivachandra, jhuber6

Differential Revision: https://reviews.llvm.org/D159477

Added: 
    libc/test/src/math/smoke/CMakeLists.txt
    libc/test/src/math/smoke/CeilTest.h
    libc/test/src/math/smoke/CopySignTest.h
    libc/test/src/math/smoke/FAbsTest.h
    libc/test/src/math/smoke/FDimTest.h
    libc/test/src/math/smoke/FMaxTest.h
    libc/test/src/math/smoke/FMinTest.h
    libc/test/src/math/smoke/FModTest.h
    libc/test/src/math/smoke/FloorTest.h
    libc/test/src/math/smoke/FmaTest.h
    libc/test/src/math/smoke/FrexpTest.h
    libc/test/src/math/smoke/HypotTest.h
    libc/test/src/math/smoke/ILogbTest.h
    libc/test/src/math/smoke/LdExpTest.h
    libc/test/src/math/smoke/LogbTest.h
    libc/test/src/math/smoke/ModfTest.h
    libc/test/src/math/smoke/NextAfterTest.h
    libc/test/src/math/smoke/RIntTest.h
    libc/test/src/math/smoke/RemQuoTest.h
    libc/test/src/math/smoke/RoundTest.h
    libc/test/src/math/smoke/RoundToIntegerTest.h
    libc/test/src/math/smoke/ScalbnTest.h
    libc/test/src/math/smoke/SqrtTest.h
    libc/test/src/math/smoke/TruncTest.h
    libc/test/src/math/smoke/acosf_test.cpp
    libc/test/src/math/smoke/acoshf_test.cpp
    libc/test/src/math/smoke/asinf_test.cpp
    libc/test/src/math/smoke/asinhf_test.cpp
    libc/test/src/math/smoke/atanf_test.cpp
    libc/test/src/math/smoke/atanhf_test.cpp
    libc/test/src/math/smoke/ceil_test.cpp
    libc/test/src/math/smoke/ceilf_test.cpp
    libc/test/src/math/smoke/ceill_test.cpp
    libc/test/src/math/smoke/copysign_test.cpp
    libc/test/src/math/smoke/copysignf_test.cpp
    libc/test/src/math/smoke/copysignl_test.cpp
    libc/test/src/math/smoke/cosf_test.cpp
    libc/test/src/math/smoke/coshf_test.cpp
    libc/test/src/math/smoke/erff_test.cpp
    libc/test/src/math/smoke/exp10_test.cpp
    libc/test/src/math/smoke/exp10f_test.cpp
    libc/test/src/math/smoke/exp2_test.cpp
    libc/test/src/math/smoke/exp2f_test.cpp
    libc/test/src/math/smoke/exp_test.cpp
    libc/test/src/math/smoke/expf_test.cpp
    libc/test/src/math/smoke/expm1f_test.cpp
    libc/test/src/math/smoke/fabs_test.cpp
    libc/test/src/math/smoke/fabsf_test.cpp
    libc/test/src/math/smoke/fabsl_test.cpp
    libc/test/src/math/smoke/fdim_test.cpp
    libc/test/src/math/smoke/fdimf_test.cpp
    libc/test/src/math/smoke/fdiml_test.cpp
    libc/test/src/math/smoke/floor_test.cpp
    libc/test/src/math/smoke/floorf_test.cpp
    libc/test/src/math/smoke/floorl_test.cpp
    libc/test/src/math/smoke/fma_test.cpp
    libc/test/src/math/smoke/fmaf_test.cpp
    libc/test/src/math/smoke/fmax_test.cpp
    libc/test/src/math/smoke/fmaxf_test.cpp
    libc/test/src/math/smoke/fmaxl_test.cpp
    libc/test/src/math/smoke/fmin_test.cpp
    libc/test/src/math/smoke/fminf_test.cpp
    libc/test/src/math/smoke/fminl_test.cpp
    libc/test/src/math/smoke/fmod_test.cpp
    libc/test/src/math/smoke/fmodf_test.cpp
    libc/test/src/math/smoke/frexp_test.cpp
    libc/test/src/math/smoke/frexpf_test.cpp
    libc/test/src/math/smoke/frexpl_test.cpp
    libc/test/src/math/smoke/generic_sqrt_test.cpp
    libc/test/src/math/smoke/generic_sqrtf_test.cpp
    libc/test/src/math/smoke/generic_sqrtl_test.cpp
    libc/test/src/math/smoke/hypot_test.cpp
    libc/test/src/math/smoke/hypotf_test.cpp
    libc/test/src/math/smoke/ilogb_test.cpp
    libc/test/src/math/smoke/ilogbf_test.cpp
    libc/test/src/math/smoke/ilogbl_test.cpp
    libc/test/src/math/smoke/ldexp_test.cpp
    libc/test/src/math/smoke/ldexpf_test.cpp
    libc/test/src/math/smoke/ldexpl_test.cpp
    libc/test/src/math/smoke/llrint_test.cpp
    libc/test/src/math/smoke/llrintf_test.cpp
    libc/test/src/math/smoke/llrintl_test.cpp
    libc/test/src/math/smoke/llround_test.cpp
    libc/test/src/math/smoke/llroundf_test.cpp
    libc/test/src/math/smoke/llroundl_test.cpp
    libc/test/src/math/smoke/log10_test.cpp
    libc/test/src/math/smoke/log10f_test.cpp
    libc/test/src/math/smoke/log1p_test.cpp
    libc/test/src/math/smoke/log1pf_test.cpp
    libc/test/src/math/smoke/log2_test.cpp
    libc/test/src/math/smoke/log2f_test.cpp
    libc/test/src/math/smoke/log_test.cpp
    libc/test/src/math/smoke/logb_test.cpp
    libc/test/src/math/smoke/logbf_test.cpp
    libc/test/src/math/smoke/logbl_test.cpp
    libc/test/src/math/smoke/logf_test.cpp
    libc/test/src/math/smoke/lrint_test.cpp
    libc/test/src/math/smoke/lrintf_test.cpp
    libc/test/src/math/smoke/lrintl_test.cpp
    libc/test/src/math/smoke/lround_test.cpp
    libc/test/src/math/smoke/lroundf_test.cpp
    libc/test/src/math/smoke/lroundl_test.cpp
    libc/test/src/math/smoke/modf_test.cpp
    libc/test/src/math/smoke/modff_test.cpp
    libc/test/src/math/smoke/modfl_test.cpp
    libc/test/src/math/smoke/nextafter_test.cpp
    libc/test/src/math/smoke/nextafterf_test.cpp
    libc/test/src/math/smoke/nextafterl_test.cpp
    libc/test/src/math/smoke/remquo_test.cpp
    libc/test/src/math/smoke/remquof_test.cpp
    libc/test/src/math/smoke/remquol_test.cpp
    libc/test/src/math/smoke/rint_test.cpp
    libc/test/src/math/smoke/rintf_test.cpp
    libc/test/src/math/smoke/rintl_test.cpp
    libc/test/src/math/smoke/round_test.cpp
    libc/test/src/math/smoke/roundf_test.cpp
    libc/test/src/math/smoke/roundl_test.cpp
    libc/test/src/math/smoke/scalbn_test.cpp
    libc/test/src/math/smoke/scalbnf_test.cpp
    libc/test/src/math/smoke/scalbnl_test.cpp
    libc/test/src/math/smoke/sincosf_test.cpp
    libc/test/src/math/smoke/sinf_test.cpp
    libc/test/src/math/smoke/sinhf_test.cpp
    libc/test/src/math/smoke/sqrt_test.cpp
    libc/test/src/math/smoke/sqrtf_test.cpp
    libc/test/src/math/smoke/sqrtl_test.cpp
    libc/test/src/math/smoke/tanf_test.cpp
    libc/test/src/math/smoke/tanhf_test.cpp
    libc/test/src/math/smoke/trunc_test.cpp
    libc/test/src/math/smoke/truncf_test.cpp
    libc/test/src/math/smoke/truncl_test.cpp

Modified: 
    libc/src/math/docs/add_math_function.md
    libc/test/src/math/CMakeLists.txt
    libc/test/src/math/generic/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/src/math/docs/add_math_function.md b/libc/src/math/docs/add_math_function.md
index cf4d31661daf39c..9efe0620f5d7d94 100644
--- a/libc/src/math/docs/add_math_function.md
+++ b/libc/src/math/docs/add_math_function.md
@@ -88,12 +88,17 @@ Besides the usual testing macros like `EXPECT_EQ, ASSERT_TRUE, ...` there are
 testing macros specifically used for floating point values, such as
 `EXPECT_FP_EQ, ASSERT_FP_LE, ...`
 
-- Add unit test to:
+- Add smoke tests (simple cases and zeros / inf / nan inputs or outputs) to:
+```
+  libc/test/src/math/smoke/<func>_test.cpp
+```
+- Add unit test that might require MPFR to:
 ```
   libc/test/src/math/<func>_test.cpp
 ```
-- Add the corresponding entry point to:
+- Add the corresponding entry points to:
 ```
+  libc/test/src/math/smoke/CMakeLists.txt
   libc/test/src/math/CMakeLists.txt
 ```
 
@@ -160,6 +165,16 @@ implementation (which is very often glibc).
   $ ninja check-libc
 ```
 
+- Run math smoke tests only:
+```
+  $ ninja libc-math-smoke-tests
+```
+
+- Run math smoke and unit tests:
+```
+  $ ninja libc-math-unittests
+```
+
 - Build and Run a specific unit test:
 ```
   $ ninja libc.test.src.math.<func>_test

diff  --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 04b1256e09b462c..d47e0e0ea4aad6e 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_custom_target(libc_math_unittests)
+add_custom_target(libc-math-unittests)
 
 add_library(
   libc_math_test_utils
@@ -10,7 +10,7 @@ add_fp_unittest(
   cosf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     cosf_test.cpp
   HDRS
@@ -26,7 +26,7 @@ add_fp_unittest(
   cos_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     cos_test.cpp
   DEPENDS
@@ -38,7 +38,7 @@ add_fp_unittest(
   sinf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     sinf_test.cpp
   HDRS
@@ -54,7 +54,7 @@ add_fp_unittest(
   sin_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     sin_test.cpp
   DEPENDS
@@ -66,7 +66,7 @@ add_fp_unittest(
   sincosf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     sincosf_test.cpp
   HDRS
@@ -82,7 +82,7 @@ add_fp_unittest(
   tanf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     tanf_test.cpp
   HDRS
@@ -98,7 +98,7 @@ add_fp_unittest(
   fabs_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fabs_test.cpp
   HDRS
@@ -113,7 +113,7 @@ add_fp_unittest(
   fabsf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fabsf_test.cpp
   HDRS
@@ -128,7 +128,7 @@ add_fp_unittest(
   fabsl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fabsl_test.cpp
   HDRS
@@ -143,7 +143,7 @@ add_fp_unittest(
   trunc_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     trunc_test.cpp
   HDRS
@@ -158,7 +158,7 @@ add_fp_unittest(
   truncf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     truncf_test.cpp
   HDRS
@@ -173,7 +173,7 @@ add_fp_unittest(
   truncl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     truncl_test.cpp
   HDRS
@@ -188,7 +188,7 @@ add_fp_unittest(
   ceil_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ceil_test.cpp
   HDRS
@@ -203,7 +203,7 @@ add_fp_unittest(
   ceilf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ceilf_test.cpp
   HDRS
@@ -218,7 +218,7 @@ add_fp_unittest(
   ceill_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ceill_test.cpp
   HDRS
@@ -233,7 +233,7 @@ add_fp_unittest(
   floor_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     floor_test.cpp
   HDRS
@@ -248,7 +248,7 @@ add_fp_unittest(
   floorf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     floorf_test.cpp
   HDRS
@@ -263,7 +263,7 @@ add_fp_unittest(
   floorl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     floorl_test.cpp
   HDRS
@@ -278,7 +278,7 @@ add_fp_unittest(
   round_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     round_test.cpp
   HDRS
@@ -293,7 +293,7 @@ add_fp_unittest(
   roundf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     roundf_test.cpp
   HDRS
@@ -308,7 +308,7 @@ add_fp_unittest(
   roundl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     roundl_test.cpp
   HDRS
@@ -323,7 +323,7 @@ add_fp_unittest(
   lround_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     lround_test.cpp
   HDRS
@@ -342,7 +342,7 @@ add_fp_unittest(
   lroundf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     lroundf_test.cpp
   HDRS
@@ -361,7 +361,7 @@ add_fp_unittest(
   lroundl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     lroundl_test.cpp
   HDRS
@@ -380,7 +380,7 @@ add_fp_unittest(
   llround_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     llround_test.cpp
   HDRS
@@ -399,7 +399,7 @@ add_fp_unittest(
   llroundf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     llroundf_test.cpp
   HDRS
@@ -418,7 +418,7 @@ add_fp_unittest(
   llroundl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     llroundl_test.cpp
   HDRS
@@ -437,7 +437,7 @@ add_fp_unittest(
   rint_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     rint_test.cpp
   HDRS
@@ -453,7 +453,7 @@ add_fp_unittest(
   rintf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     rintf_test.cpp
   HDRS
@@ -469,7 +469,7 @@ add_fp_unittest(
   rintl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     rintl_test.cpp
   HDRS
@@ -485,7 +485,7 @@ add_fp_unittest(
   lrint_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     lrint_test.cpp
   HDRS
@@ -501,7 +501,7 @@ add_fp_unittest(
   lrintf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     lrintf_test.cpp
   HDRS
@@ -517,7 +517,7 @@ add_fp_unittest(
   lrintl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     lrintl_test.cpp
   HDRS
@@ -533,7 +533,7 @@ add_fp_unittest(
   llrint_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     llrint_test.cpp
   HDRS
@@ -549,7 +549,7 @@ add_fp_unittest(
   llrintf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     llrintf_test.cpp
   HDRS
@@ -565,7 +565,7 @@ add_fp_unittest(
   llrintl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     llrintl_test.cpp
   HDRS
@@ -581,7 +581,7 @@ add_fp_unittest(
   expf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     expf_test.cpp
   DEPENDS
@@ -595,7 +595,7 @@ add_fp_unittest(
  exp_test
  NEED_MPFR
  SUITE
-   libc_math_unittests
+   libc-math-unittests
  SRCS
    exp_test.cpp
  DEPENDS
@@ -609,7 +609,7 @@ add_fp_unittest(
   exp2f_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     exp2f_test.cpp
   DEPENDS
@@ -623,7 +623,7 @@ add_fp_unittest(
  exp2_test
  NEED_MPFR
  SUITE
-   libc_math_unittests
+   libc-math-unittests
  SRCS
    exp2_test.cpp
  DEPENDS
@@ -637,7 +637,7 @@ add_fp_unittest(
   exp10f_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     exp10f_test.cpp
   DEPENDS
@@ -651,7 +651,7 @@ add_fp_unittest(
  exp10_test
  NEED_MPFR
  SUITE
-   libc_math_unittests
+   libc-math-unittests
  SRCS
    exp10_test.cpp
  DEPENDS
@@ -664,7 +664,7 @@ add_fp_unittest(
 add_fp_unittest(
   copysign_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     copysign_test.cpp
   HDRS
@@ -678,7 +678,7 @@ add_fp_unittest(
 add_fp_unittest(
   copysignf_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     copysignf_test.cpp
   HDRS
@@ -692,7 +692,7 @@ add_fp_unittest(
 add_fp_unittest(
   copysignl_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     copysignl_test.cpp
   HDRS
@@ -707,7 +707,7 @@ add_fp_unittest(
   frexp_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     frexp_test.cpp
   HDRS
@@ -722,7 +722,7 @@ add_fp_unittest(
   frexpf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     frexpf_test.cpp
   HDRS
@@ -737,7 +737,7 @@ add_fp_unittest(
   frexpl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     frexpl_test.cpp
   HDRS
@@ -753,7 +753,7 @@ if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
   add_fp_unittest(
     ilogb_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       ilogb_test.cpp
     HDRS
@@ -768,7 +768,7 @@ if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
   add_fp_unittest(
     ilogbf_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       ilogbf_test.cpp
     HDRS
@@ -784,7 +784,7 @@ endif()
 add_fp_unittest(
   ilogbl_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ilogbl_test.cpp
   HDRS
@@ -799,7 +799,7 @@ add_fp_unittest(
 add_fp_unittest(
   ldexp_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ldexp_test.cpp
   HDRS
@@ -814,7 +814,7 @@ add_fp_unittest(
 add_fp_unittest(
   ldexpf_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ldexpf_test.cpp
   HDRS
@@ -829,7 +829,7 @@ add_fp_unittest(
 add_fp_unittest(
   ldexpl_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ldexpl_test.cpp
   HDRS
@@ -844,7 +844,7 @@ add_fp_unittest(
 add_fp_unittest(
   logb_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     logb_test.cpp
   DEPENDS
@@ -856,7 +856,7 @@ add_fp_unittest(
 add_fp_unittest(
   logbf_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     logbf_test.cpp
   DEPENDS
@@ -868,7 +868,7 @@ add_fp_unittest(
 add_fp_unittest(
   logbl_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     logbl_test.cpp
   HDRS
@@ -882,7 +882,7 @@ add_fp_unittest(
 add_fp_unittest(
   modf_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     modf_test.cpp
   HDRS
@@ -899,7 +899,7 @@ add_fp_unittest(
 add_fp_unittest(
   modff_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     modff_test.cpp
   HDRS
@@ -916,7 +916,7 @@ add_fp_unittest(
 add_fp_unittest(
   modfl_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     modfl_test.cpp
   HDRS
@@ -931,7 +931,7 @@ add_fp_unittest(
 add_fp_unittest(
   fdimf_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fdimf_test.cpp
   HDRS
@@ -946,7 +946,7 @@ add_fp_unittest(
 add_fp_unittest(
   fdim_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fdim_test.cpp
   HDRS
@@ -961,7 +961,7 @@ add_fp_unittest(
 add_fp_unittest(
   fdiml_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fdiml_test.cpp
   HDRS
@@ -978,7 +978,7 @@ if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
   add_fp_unittest(
     fminf_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       fminf_test.cpp
     HDRS
@@ -992,7 +992,7 @@ if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
   add_fp_unittest(
     fmin_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       fmin_test.cpp
     HDRS
@@ -1006,7 +1006,7 @@ if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
   add_fp_unittest(
     fminl_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       fminl_test.cpp
     HDRS
@@ -1020,7 +1020,7 @@ if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
   add_fp_unittest(
     fmaxf_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       fmaxf_test.cpp
     HDRS
@@ -1034,7 +1034,7 @@ if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
   add_fp_unittest(
     fmax_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       fmax_test.cpp
     HDRS
@@ -1048,7 +1048,7 @@ if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
   add_fp_unittest(
     fmaxl_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       fmaxl_test.cpp
     HDRS
@@ -1064,7 +1064,7 @@ add_fp_unittest(
   sqrtf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     sqrtf_test.cpp
   DEPENDS
@@ -1077,7 +1077,7 @@ add_fp_unittest(
   sqrt_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     sqrt_test.cpp
   DEPENDS
@@ -1090,7 +1090,7 @@ add_fp_unittest(
   sqrtl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     sqrtl_test.cpp
   DEPENDS
@@ -1103,7 +1103,7 @@ add_fp_unittest(
   generic_sqrtf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     generic_sqrtf_test.cpp
   DEPENDS
@@ -1118,7 +1118,7 @@ add_fp_unittest(
   generic_sqrt_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     generic_sqrt_test.cpp
   DEPENDS
@@ -1133,7 +1133,7 @@ add_fp_unittest(
   generic_sqrtl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     generic_sqrtl_test.cpp
   DEPENDS
@@ -1148,7 +1148,7 @@ add_fp_unittest(
   remquof_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     remquof_test.cpp
   HDRS
@@ -1164,7 +1164,7 @@ add_fp_unittest(
   remquo_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     remquo_test.cpp
   HDRS
@@ -1180,7 +1180,7 @@ add_fp_unittest(
   remquol_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     remquol_test.cpp
   HDRS
@@ -1196,7 +1196,7 @@ add_fp_unittest(
   hypotf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     hypotf_test.cpp
   DEPENDS
@@ -1209,7 +1209,7 @@ add_fp_unittest(
   hypot_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     hypot_test.cpp
   DEPENDS
@@ -1223,7 +1223,7 @@ if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
   add_fp_unittest(
     nextafter_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       nextafter_test.cpp
     HDRS
@@ -1238,7 +1238,7 @@ if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
   add_fp_unittest(
     nextafterf_test
     SUITE
-      libc_math_unittests
+      libc-math-unittests
     SRCS
       nextafterf_test.cpp
     HDRS
@@ -1254,7 +1254,7 @@ endif()
 add_fp_unittest(
   nextafterl_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     nextafterl_test.cpp
   HDRS
@@ -1272,7 +1272,7 @@ add_fp_unittest(
   fmaf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fmaf_test.cpp
   DEPENDS
@@ -1287,7 +1287,7 @@ add_fp_unittest(
   fma_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fma_test.cpp
   DEPENDS
@@ -1300,7 +1300,7 @@ add_fp_unittest(
   tan_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     tan_test.cpp
   DEPENDS
@@ -1312,7 +1312,7 @@ add_fp_unittest(
   expm1f_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     expm1f_test.cpp
   DEPENDS
@@ -1326,7 +1326,7 @@ add_fp_unittest(
  log_test
  NEED_MPFR
  SUITE
-   libc_math_unittests
+   libc-math-unittests
  SRCS
    log_test.cpp
  DEPENDS
@@ -1340,7 +1340,7 @@ add_fp_unittest(
   logf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     logf_test.cpp
   DEPENDS
@@ -1354,7 +1354,7 @@ add_fp_unittest(
 log2_test
  NEED_MPFR
  SUITE
-   libc_math_unittests
+   libc-math-unittests
  SRCS
    log2_test.cpp
  DEPENDS
@@ -1368,7 +1368,7 @@ add_fp_unittest(
   log2f_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     log2f_test.cpp
   DEPENDS
@@ -1382,7 +1382,7 @@ add_fp_unittest(
  log10_test
  NEED_MPFR
  SUITE
-   libc_math_unittests
+   libc-math-unittests
  SRCS
    log10_test.cpp
  DEPENDS
@@ -1396,7 +1396,7 @@ add_fp_unittest(
   log10f_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     log10f_test.cpp
   DEPENDS
@@ -1410,7 +1410,7 @@ add_fp_unittest(
 log1p_test
  NEED_MPFR
  SUITE
-   libc_math_unittests
+   libc-math-unittests
  SRCS
    log1p_test.cpp
  DEPENDS
@@ -1424,7 +1424,7 @@ add_fp_unittest(
   log1pf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     log1pf_test.cpp
   DEPENDS
@@ -1437,7 +1437,7 @@ add_fp_unittest(
 add_fp_unittest(
   fmodf_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fmodf_test.cpp
   HDRS
@@ -1455,7 +1455,7 @@ add_fp_unittest(
 add_fp_unittest(
   fmod_test
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     fmod_test.cpp
   HDRS
@@ -1474,7 +1474,7 @@ add_fp_unittest(
   explogxf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   HDRS
     in_float_range_test_helper.h
   SRCS
@@ -1489,7 +1489,7 @@ add_fp_unittest(
   coshf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     coshf_test.cpp
   HDRS
@@ -1505,7 +1505,7 @@ add_fp_unittest(
   sinhf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     sinhf_test.cpp
   HDRS
@@ -1521,7 +1521,7 @@ add_fp_unittest(
   tanhf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     tanhf_test.cpp
   DEPENDS
@@ -1533,7 +1533,7 @@ add_fp_unittest(
   atanhf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     atanhf_test.cpp
   DEPENDS
@@ -1546,7 +1546,7 @@ add_fp_unittest(
   asinhf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     asinhf_test.cpp
   DEPENDS
@@ -1559,7 +1559,7 @@ add_fp_unittest(
   acoshf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     acoshf_test.cpp
   DEPENDS
@@ -1572,7 +1572,7 @@ add_fp_unittest(
   asinf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     asinf_test.cpp
   DEPENDS
@@ -1585,7 +1585,7 @@ add_fp_unittest(
   acosf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     acosf_test.cpp
   DEPENDS
@@ -1598,7 +1598,7 @@ add_fp_unittest(
   atanf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     atanf_test.cpp
   DEPENDS
@@ -1611,7 +1611,7 @@ add_fp_unittest(
   inv_trigf_utils_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   HDRS
     in_float_range_test_helper.h
   SRCS
@@ -1625,7 +1625,7 @@ add_fp_unittest(
   scalbn_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     scalbn_test.cpp
   HDRS
@@ -1641,7 +1641,7 @@ add_fp_unittest(
   scalbnf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     scalbnf_test.cpp
   HDRS
@@ -1657,7 +1657,7 @@ add_fp_unittest(
   scalbnl_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     scalbnl_test.cpp
   HDRS
@@ -1673,7 +1673,7 @@ add_fp_unittest(
   erff_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     erff_test.cpp
   DEPENDS
@@ -1683,6 +1683,7 @@ add_fp_unittest(
 )
 
 add_subdirectory(generic)
+add_subdirectory(smoke)
 
 if(NOT LLVM_LIBC_FULL_BUILD)
   add_subdirectory(exhaustive)

diff  --git a/libc/test/src/math/generic/CMakeLists.txt b/libc/test/src/math/generic/CMakeLists.txt
index 9803f34873e5d09..bc2b5cea89d123b 100644
--- a/libc/test/src/math/generic/CMakeLists.txt
+++ b/libc/test/src/math/generic/CMakeLists.txt
@@ -2,7 +2,7 @@ add_fp_unittest(
   ceil_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ../ceil_test.cpp
   DEPENDS
@@ -14,7 +14,7 @@ add_fp_unittest(
   ceilf_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ../ceilf_test.cpp
   DEPENDS
@@ -26,7 +26,7 @@ add_fp_unittest(
   ceill_test
   NEED_MPFR
   SUITE
-    libc_math_unittests
+    libc-math-unittests
   SRCS
     ../ceill_test.cpp
   DEPENDS

diff  --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
new file mode 100644
index 000000000000000..803f6d2b9389bbb
--- /dev/null
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -0,0 +1,1523 @@
+add_custom_target(libc-math-smoke-tests)
+add_dependencies(libc-math-unittests libc-math-smoke-tests)
+
+add_fp_unittest(
+  cosf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    cosf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.cosf
+    libc.src.__support.CPP.array
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  sinf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    sinf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.sinf
+    libc.src.__support.CPP.array
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  sincosf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    sincosf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.sincosf
+    libc.src.__support.CPP.array
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  tanf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    tanf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.tanf
+    libc.src.__support.CPP.array
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fabs_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fabs_test.cpp
+  HDRS
+    FAbsTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.fabs
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fabsf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fabsf_test.cpp
+  HDRS
+    FAbsTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.fabsf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fabsl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fabsl_test.cpp
+  HDRS
+    FAbsTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.fabsl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  trunc_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    trunc_test.cpp
+  HDRS
+    TruncTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.trunc
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  truncf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    truncf_test.cpp
+  HDRS
+    TruncTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.truncf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  truncl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    truncl_test.cpp
+  HDRS
+    TruncTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.truncl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  ceil_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ceil_test.cpp
+  HDRS
+    CeilTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.ceil
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  ceilf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ceilf_test.cpp
+  HDRS
+    CeilTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.ceilf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  ceill_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ceill_test.cpp
+  HDRS
+    CeilTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.ceill
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  floor_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    floor_test.cpp
+  HDRS
+    FloorTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.floor
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  floorf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    floorf_test.cpp
+  HDRS
+    FloorTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.floorf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  floorl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    floorl_test.cpp
+  HDRS
+    FloorTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.floorl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  round_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    round_test.cpp
+  HDRS
+    RoundTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.round
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  roundf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    roundf_test.cpp
+  HDRS
+    RoundTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.roundf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  roundl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    roundl_test.cpp
+  HDRS
+    RoundTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.roundl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  lround_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    lround_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.errno.errno
+    libc.src.fenv.feclearexcept
+    libc.src.fenv.feraiseexcept
+    libc.src.fenv.fetestexcept
+    libc.src.math.lround
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  lroundf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    lroundf_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.errno.errno
+    libc.src.fenv.feclearexcept
+    libc.src.fenv.feraiseexcept
+    libc.src.fenv.fetestexcept
+    libc.src.math.lroundf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  lroundl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    lroundl_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.errno.errno
+    libc.src.fenv.feclearexcept
+    libc.src.fenv.feraiseexcept
+    libc.src.fenv.fetestexcept
+    libc.src.math.lroundl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  llround_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    llround_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.errno.errno
+    libc.src.fenv.feclearexcept
+    libc.src.fenv.feraiseexcept
+    libc.src.fenv.fetestexcept
+    libc.src.math.llround
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  llroundf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    llroundf_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.errno.errno
+    libc.src.fenv.feclearexcept
+    libc.src.fenv.feraiseexcept
+    libc.src.fenv.fetestexcept
+    libc.src.math.llroundf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  llroundl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    llroundl_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.errno.errno
+    libc.src.fenv.feclearexcept
+    libc.src.fenv.feraiseexcept
+    libc.src.fenv.fetestexcept
+    libc.src.math.llroundl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  rint_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    rint_test.cpp
+  HDRS
+    RIntTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.rint
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  rintf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    rintf_test.cpp
+  HDRS
+    RIntTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.rintf
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  rintl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    rintl_test.cpp
+  HDRS
+    RIntTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.rintl
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  lrint_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    lrint_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.lrint
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  lrintf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    lrintf_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.lrintf
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  lrintl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    lrintl_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.lrintl
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  llrint_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    llrint_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.llrint
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  llrintf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    llrintf_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.llrintf
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  llrintl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    llrintl_test.cpp
+  HDRS
+    RoundToIntegerTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.llrintl
+    libc.src.__support.FPUtil.fenv_impl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  expf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    expf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.expf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+ exp_test
+ SUITE
+   libc-math-smoke-tests
+ SRCS
+   exp_test.cpp
+ DEPENDS
+   libc.src.errno.errno
+   libc.include.math
+   libc.src.math.exp
+   libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  exp2f_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    exp2f_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.exp2f
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+ exp2_test
+ SUITE
+   libc-math-smoke-tests
+ SRCS
+   exp2_test.cpp
+ DEPENDS
+   libc.src.errno.errno
+   libc.include.math
+   libc.src.math.exp2
+   libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  exp10f_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    exp10f_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.exp10f
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+ exp10_test
+ SUITE
+   libc-math-smoke-tests
+ SRCS
+   exp10_test.cpp
+ DEPENDS
+   libc.src.errno.errno
+   libc.include.math
+   libc.src.math.exp10
+   libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  copysign_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    copysign_test.cpp
+  HDRS
+    CopySignTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.copysign
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  copysignf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    copysignf_test.cpp
+  HDRS
+    CopySignTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.copysignf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  copysignl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    copysignl_test.cpp
+  HDRS
+    CopySignTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.copysignl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  frexp_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    frexp_test.cpp
+  HDRS
+    FrexpTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.frexp
+    libc.src.__support.FPUtil.basic_operations
+)
+
+add_fp_unittest(
+  frexpf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    frexpf_test.cpp
+  HDRS
+    FrexpTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.frexpf
+    libc.src.__support.FPUtil.basic_operations
+)
+
+add_fp_unittest(
+  frexpl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    frexpl_test.cpp
+  HDRS
+    FrexpTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.frexpl
+    libc.src.__support.FPUtil.basic_operations
+)
+
+# FIXME: These tests are currently broken for NVPTX.
+if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
+  add_fp_unittest(
+    ilogb_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      ilogb_test.cpp
+    HDRS
+      ILogbTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.ilogb
+      libc.src.__support.FPUtil.fp_bits
+      libc.src.__support.FPUtil.manipulation_functions
+  )
+
+  add_fp_unittest(
+    ilogbf_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      ilogbf_test.cpp
+    HDRS
+      ILogbTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.ilogbf
+      libc.src.__support.FPUtil.fp_bits
+      libc.src.__support.FPUtil.manipulation_functions
+  )
+endif()
+
+add_fp_unittest(
+  ilogbl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ilogbl_test.cpp
+  HDRS
+    ILogbTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.ilogbl
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.manipulation_functions
+)
+
+add_fp_unittest(
+  ldexp_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ldexp_test.cpp
+  HDRS
+    LdExpTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.ldexp
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
+  ldexpf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ldexpf_test.cpp
+  HDRS
+    LdExpTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.ldexpf
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
+  ldexpl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ldexpl_test.cpp
+  HDRS
+    LdExpTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.ldexpl
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
+  logb_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    logb_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.logb
+    libc.src.__support.FPUtil.manipulation_functions
+)
+
+add_fp_unittest(
+  logbf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    logbf_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.logbf
+    libc.src.__support.FPUtil.manipulation_functions
+)
+
+add_fp_unittest(
+  logbl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    logbl_test.cpp
+  HDRS
+    LogbTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.logbl
+    libc.src.__support.FPUtil.manipulation_functions
+)
+
+add_fp_unittest(
+  modf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    modf_test.cpp
+  HDRS
+    ModfTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.modf
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.nearest_integer_operations
+  # Requires C++ limits.
+  UNIT_TEST_ONLY
+)
+
+add_fp_unittest(
+  modff_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    modff_test.cpp
+  HDRS
+    ModfTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.modff
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.nearest_integer_operations
+  # Requires C++ limits.
+  UNIT_TEST_ONLY
+)
+
+add_fp_unittest(
+  modfl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    modfl_test.cpp
+  HDRS
+    ModfTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.modfl
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.nearest_integer_operations
+)
+
+add_fp_unittest(
+  fdimf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fdimf_test.cpp
+  HDRS
+    FDimTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.fdimf
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fdim_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fdim_test.cpp
+  HDRS
+    FDimTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.fdim
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fdiml_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fdiml_test.cpp
+  HDRS
+    FDimTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.fdiml
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.fp_bits
+)
+
+# FIXME: These tests are currently broken on the GPU.
+if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
+  add_fp_unittest(
+    fminf_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      fminf_test.cpp
+    HDRS
+      FMinTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fminf
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fmin_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      fmin_test.cpp
+    HDRS
+      FMinTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fmin
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fminl_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      fminl_test.cpp
+    HDRS
+      FMinTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fminl
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fmaxf_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      fmaxf_test.cpp
+    HDRS
+      FMaxTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fmaxf
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fmax_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      fmax_test.cpp
+    HDRS
+      FMaxTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fmax
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fmaxl_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      fmaxl_test.cpp
+    HDRS
+      FMaxTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fmaxl
+      libc.src.__support.FPUtil.fp_bits
+  )
+endif()
+
+add_fp_unittest(
+  sqrtf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    sqrtf_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.sqrtf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  sqrt_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    sqrt_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.sqrt
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  sqrtl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    sqrtl_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.sqrtl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  generic_sqrtf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    generic_sqrtf_test.cpp
+  DEPENDS
+    libc.src.math.sqrtf
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.generic.sqrt
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_fp_unittest(
+  generic_sqrt_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    generic_sqrt_test.cpp
+  DEPENDS
+    libc.src.math.sqrt
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.generic.sqrt
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_fp_unittest(
+  generic_sqrtl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    generic_sqrtl_test.cpp
+  DEPENDS
+    libc.src.math.sqrtl
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.generic.sqrt
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_fp_unittest(
+  remquof_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    remquof_test.cpp
+  HDRS
+    RemQuoTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.remquof
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  remquo_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    remquo_test.cpp
+  HDRS
+    RemQuoTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.remquo
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  remquol_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    remquol_test.cpp
+  HDRS
+    RemQuoTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.remquol
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  hypotf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    hypotf_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.hypotf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  hypot_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    hypot_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.hypot
+    libc.src.__support.FPUtil.fp_bits
+)
+
+# FIXME: These tests are currently spurious for NVPTX.
+if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
+  add_fp_unittest(
+    nextafter_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      nextafter_test.cpp
+    HDRS
+      NextAfterTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.nextafter
+      libc.src.__support.FPUtil.basic_operations
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    nextafterf_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      nextafterf_test.cpp
+    HDRS
+      NextAfterTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.nextafterf
+      libc.src.__support.FPUtil.basic_operations
+      libc.src.__support.FPUtil.fp_bits
+  )
+endif()
+
+add_fp_unittest(
+  nextafterl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    nextafterl_test.cpp
+  HDRS
+    NextAfterTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.nextafterl
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.fp_bits
+)
+
+# TODO(lntue): The current implementation of fputil::general::fma<float> is only
+# correctly rounded for the default rounding mode round-to-nearest tie-to-even.
+add_fp_unittest(
+  fmaf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaf_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.fmaf
+    libc.src.__support.FPUtil.fp_bits
+  FLAGS
+    FMA_OPT__ONLY
+)
+
+add_fp_unittest(
+  fma_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fma_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.fma
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  expm1f_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    expm1f_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.expm1f
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  log_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    log_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.log
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  logf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    logf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.logf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  log2_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    log2_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.log2
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  log2f_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    log2f_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.log2f
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  log10_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    log10_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.log10
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  log10f_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    log10f_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.log10f
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  log1p_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    log1p_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.log1p
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  log1pf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    log1pf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.include.math
+    libc.src.math.log1pf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmodf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmodf_test.cpp
+  HDRS
+    FModTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.errno.errno
+    libc.src.math.fmodf
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.nearest_integer_operations
+  # Requires C++ limits.
+  UNIT_TEST_ONLY
+)
+
+add_fp_unittest(
+  fmod_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmod_test.cpp
+  HDRS
+    FModTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.errno.errno
+    libc.src.math.fmod
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.nearest_integer_operations
+  # Requires C++ limits.
+  UNIT_TEST_ONLY
+)
+
+add_fp_unittest(
+  coshf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    coshf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.coshf
+    libc.src.__support.CPP.array
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  sinhf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    sinhf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.sinhf
+    libc.src.__support.CPP.array
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  tanhf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    tanhf_test.cpp
+  DEPENDS
+    libc.src.math.tanhf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  atanhf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    atanhf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.atanhf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  asinhf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    asinhf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.asinhf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  acoshf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    acoshf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.acoshf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  asinf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    asinf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.asinf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  acosf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    acosf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.acosf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  atanf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    atanf_test.cpp
+  DEPENDS
+    libc.src.errno.errno
+    libc.src.math.atanf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  scalbn_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    scalbn_test.cpp
+  HDRS
+    ScalbnTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.scalbn
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
+  scalbnf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    scalbnf_test.cpp
+  HDRS
+    ScalbnTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.scalbnf
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
+  scalbnl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    scalbnl_test.cpp
+  HDRS
+    ScalbnTest.h
+  DEPENDS
+    libc.include.math
+    libc.src.math.scalbnl
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.FPUtil.normal_float
+)
+
+add_fp_unittest(
+  erff_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    erff_test.cpp
+  DEPENDS
+    libc.include.math
+    libc.src.math.erff
+    libc.src.__support.FPUtil.fp_bits
+)

diff  --git a/libc/test/src/math/smoke/CeilTest.h b/libc/test/src/math/smoke/CeilTest.h
new file mode 100644
index 000000000000000..053218386cbcf31
--- /dev/null
+++ b/libc/test/src/math/smoke/CeilTest.h
@@ -0,0 +1,68 @@
+//===-- Utility class to test ceil[f|l] -------------------------*- C++ -*-===//
+//
+// 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 "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class CeilTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*CeilFunc)(T);
+
+  void testSpecialNumbers(CeilFunc func) {
+    EXPECT_FP_EQ(zero, func(zero));
+    EXPECT_FP_EQ(neg_zero, func(neg_zero));
+
+    EXPECT_FP_EQ(inf, func(inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf));
+
+    EXPECT_FP_EQ(aNaN, func(aNaN));
+  }
+
+  void testRoundedNumbers(CeilFunc func) {
+    EXPECT_FP_EQ(T(1.0), func(T(1.0)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.0)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.0)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.0)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.0)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.0)));
+  }
+
+  void testFractions(CeilFunc func) {
+    EXPECT_FP_EQ(T(1.0), func(T(0.5)));
+    EXPECT_FP_EQ(T(-0.0), func(T(-0.5)));
+    EXPECT_FP_EQ(T(1.0), func(T(0.115)));
+    EXPECT_FP_EQ(T(-0.0), func(T(-0.115)));
+    EXPECT_FP_EQ(T(1.0), func(T(0.715)));
+    EXPECT_FP_EQ(T(-0.0), func(T(-0.715)));
+    EXPECT_FP_EQ(T(2.0), func(T(1.3)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.3)));
+    EXPECT_FP_EQ(T(2.0), func(T(1.5)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.5)));
+    EXPECT_FP_EQ(T(2.0), func(T(1.75)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.75)));
+    EXPECT_FP_EQ(T(11.0), func(T(10.32)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.32)));
+    EXPECT_FP_EQ(T(11.0), func(T(10.65)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.65)));
+    EXPECT_FP_EQ(T(1235.0), func(T(1234.38)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.38)));
+    EXPECT_FP_EQ(T(1235.0), func(T(1234.96)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.96)));
+  }
+};
+
+#define LIST_CEIL_TESTS(T, func)                                               \
+  using LlvmLibcCeilTest = CeilTest<T>;                                        \
+  TEST_F(LlvmLibcCeilTest, SpecialNumbers) { testSpecialNumbers(&func); }      \
+  TEST_F(LlvmLibcCeilTest, RoundedNubmers) { testRoundedNumbers(&func); }      \
+  TEST_F(LlvmLibcCeilTest, Fractions) { testFractions(&func); }

diff  --git a/libc/test/src/math/smoke/CopySignTest.h b/libc/test/src/math/smoke/CopySignTest.h
new file mode 100644
index 000000000000000..2d50dd4877b10a7
--- /dev/null
+++ b/libc/test/src/math/smoke/CopySignTest.h
@@ -0,0 +1,52 @@
+//===-- Utility class to test copysign[f|l] ---------------------*- C++ -*-===//
+//
+// 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 "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class CopySignTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*CopySignFunc)(T, T);
+
+  void testSpecialNumbers(CopySignFunc func) {
+    EXPECT_FP_EQ(aNaN, func(aNaN, -1.0));
+    EXPECT_FP_EQ(aNaN, func(aNaN, 1.0));
+
+    EXPECT_FP_EQ(neg_inf, func(inf, -1.0));
+    EXPECT_FP_EQ(inf, func(neg_inf, 1.0));
+
+    EXPECT_FP_EQ(neg_zero, func(zero, -1.0));
+    EXPECT_FP_EQ(zero, func(neg_zero, 1.0));
+  }
+
+  void testRange(CopySignFunc func) {
+    constexpr UIntType COUNT = 100'000;
+    constexpr UIntType STEP = UIntType(-1) / COUNT;
+    for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
+      T x = T(FPBits(v));
+      if (isnan(x) || isinf(x))
+        continue;
+
+      double res1 = func(x, -x);
+      ASSERT_FP_EQ(res1, -x);
+
+      double res2 = func(x, x);
+      ASSERT_FP_EQ(res2, x);
+    }
+  }
+};
+
+#define LIST_COPYSIGN_TESTS(T, func)                                           \
+  using LlvmLibcCopySignTest = CopySignTest<T>;                                \
+  TEST_F(LlvmLibcCopySignTest, SpecialNumbers) { testSpecialNumbers(&func); }  \
+  TEST_F(LlvmLibcCopySignTest, Range) { testRange(&func); }

diff  --git a/libc/test/src/math/smoke/FAbsTest.h b/libc/test/src/math/smoke/FAbsTest.h
new file mode 100644
index 000000000000000..df79703d42b1eb8
--- /dev/null
+++ b/libc/test/src/math/smoke/FAbsTest.h
@@ -0,0 +1,37 @@
+//===-- Utility class to test fabs[f|l] -------------------------*- C++ -*-===//
+//
+// 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 "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class FAbsTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FabsFunc)(T);
+
+  void testSpecialNumbers(FabsFunc func) {
+    EXPECT_FP_EQ_ALL_ROUNDING(aNaN, func(aNaN));
+
+    EXPECT_FP_EQ_ALL_ROUNDING(inf, func(inf));
+    EXPECT_FP_EQ_ALL_ROUNDING(inf, func(neg_inf));
+
+    EXPECT_FP_EQ_ALL_ROUNDING(zero, func(zero));
+    EXPECT_FP_EQ_ALL_ROUNDING(zero, func(neg_zero));
+
+    EXPECT_FP_EQ_ALL_ROUNDING(T(1), func(T(1)));
+    EXPECT_FP_EQ_ALL_ROUNDING(T(1), func(T(-1)));
+  }
+};
+
+#define LIST_FABS_TESTS(T, func)                                               \
+  using LlvmLibcFAbsTest = FAbsTest<T>;                                        \
+  TEST_F(LlvmLibcFAbsTest, SpecialNumbers) { testSpecialNumbers(&func); }

diff  --git a/libc/test/src/math/smoke/FDimTest.h b/libc/test/src/math/smoke/FDimTest.h
new file mode 100644
index 000000000000000..c0dbda10b318b97
--- /dev/null
+++ b/libc/test/src/math/smoke/FDimTest.h
@@ -0,0 +1,82 @@
+//===-- Utility class to test 
diff erent flavors of fdim ---------*- C++ -*-===//
+//
+// 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/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+template <typename T>
+class FDimTestTemplate : public __llvm_libc::testing::Test {
+public:
+  using FuncPtr = T (*)(T, T);
+  using FPBits = __llvm_libc::fputil::FPBits<T>;
+  using UIntType = typename FPBits::UIntType;
+
+  void test_na_n_arg(FuncPtr func) {
+    EXPECT_FP_EQ(nan, func(nan, inf));
+    EXPECT_FP_EQ(nan, func(neg_inf, nan));
+    EXPECT_FP_EQ(nan, func(nan, zero));
+    EXPECT_FP_EQ(nan, func(neg_zero, nan));
+    EXPECT_FP_EQ(nan, func(nan, T(-1.2345)));
+    EXPECT_FP_EQ(nan, func(T(1.2345), nan));
+    EXPECT_FP_EQ(func(nan, nan), nan);
+  }
+
+  void test_inf_arg(FuncPtr func) {
+    EXPECT_FP_EQ(zero, func(neg_inf, inf));
+    EXPECT_FP_EQ(inf, func(inf, zero));
+    EXPECT_FP_EQ(zero, func(neg_zero, inf));
+    EXPECT_FP_EQ(inf, func(inf, T(1.2345)));
+    EXPECT_FP_EQ(zero, func(T(-1.2345), inf));
+  }
+
+  void test_neg_inf_arg(FuncPtr func) {
+    EXPECT_FP_EQ(inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(zero, func(neg_inf, zero));
+    EXPECT_FP_EQ(inf, func(neg_zero, neg_inf));
+    EXPECT_FP_EQ(zero, func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(inf, func(T(1.2345), neg_inf));
+  }
+
+  void test_both_zero(FuncPtr func) {
+    EXPECT_FP_EQ(zero, func(zero, zero));
+    EXPECT_FP_EQ(zero, func(zero, neg_zero));
+    EXPECT_FP_EQ(zero, func(neg_zero, zero));
+    EXPECT_FP_EQ(zero, func(neg_zero, neg_zero));
+  }
+
+  void test_in_range(FuncPtr func) {
+    constexpr UIntType COUNT = 100'001;
+    constexpr UIntType STEP = UIntType(-1) / COUNT;
+    for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      T x = T(FPBits(v)), y = T(FPBits(w));
+      if (isnan(x) || isinf(x))
+        continue;
+      if (isnan(y) || isinf(y))
+        continue;
+
+      if (x > y) {
+        EXPECT_FP_EQ(x - y, func(x, y));
+      } else {
+        EXPECT_FP_EQ(zero, func(x, y));
+      }
+    }
+  }
+
+private:
+  // constexpr does not work on FPBits yet, so we cannot have these constants as
+  // static.
+  const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
+  const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
+  const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
+  const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
+  const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
+};

diff  --git a/libc/test/src/math/smoke/FMaxTest.h b/libc/test/src/math/smoke/FMaxTest.h
new file mode 100644
index 000000000000000..5c353a6b7e0efc2
--- /dev/null
+++ b/libc/test/src/math/smoke/FMaxTest.h
@@ -0,0 +1,82 @@
+//===-- Utility class to test fmin[f|l] -------------------------*- C++ -*-===//
+//
+// 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 "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class FMaxTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMaxFunc)(T, T);
+
+  void testNaN(FMaxFunc func) {
+    EXPECT_FP_EQ(inf, func(aNaN, inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
+    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMaxFunc func) {
+    EXPECT_FP_EQ(inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(inf, func(inf, 0.0));
+    EXPECT_FP_EQ(inf, func(-0.0, inf));
+    EXPECT_FP_EQ(inf, func(inf, T(1.2345)));
+    EXPECT_FP_EQ(inf, func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMaxFunc func) {
+    EXPECT_FP_EQ(inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(0.0, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(T(-1.2345), func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMaxFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMaxFunc func) {
+    constexpr UIntType COUNT = 100'001;
+    constexpr UIntType STEP = UIntType(-1) / COUNT;
+    for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      T x = T(FPBits(v)), y = T(FPBits(w));
+      if (isnan(x) || isinf(x))
+        continue;
+      if (isnan(y) || isinf(y))
+        continue;
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (x > y) {
+        EXPECT_FP_EQ(x, func(x, y));
+      } else {
+        EXPECT_FP_EQ(y, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMAX_TESTS(T, func)                                               \
+  using LlvmLibcFMaxTest = FMaxTest<T>;                                        \
+  TEST_F(LlvmLibcFMaxTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMaxTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMaxTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMaxTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMaxTest, Range) { testRange(&func); }

diff  --git a/libc/test/src/math/smoke/FMinTest.h b/libc/test/src/math/smoke/FMinTest.h
new file mode 100644
index 000000000000000..071ab75928c4bcb
--- /dev/null
+++ b/libc/test/src/math/smoke/FMinTest.h
@@ -0,0 +1,82 @@
+//===-- Utility class to test fmin[f|l] -------------------------*- C++ -*-===//
+//
+// 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 "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class FMinTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMinFunc)(T, T);
+
+  void testNaN(FMinFunc func) {
+    EXPECT_FP_EQ(inf, func(aNaN, inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
+    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMinFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(0.0, func(inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, inf));
+    EXPECT_FP_EQ(T(1.2345), func(inf, T(1.2345)));
+    EXPECT_FP_EQ(T(-1.2345), func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMinFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(neg_inf, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(neg_inf, func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMinFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMinFunc func) {
+    constexpr UIntType COUNT = 100'001;
+    constexpr UIntType STEP = UIntType(-1) / COUNT;
+    for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      T x = T(FPBits(v)), y = T(FPBits(w));
+      if (isnan(x) || isinf(x))
+        continue;
+      if (isnan(y) || isinf(y))
+        continue;
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (x > y) {
+        EXPECT_FP_EQ(y, func(x, y));
+      } else {
+        EXPECT_FP_EQ(x, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMIN_TESTS(T, func)                                               \
+  using LlvmLibcFMinTest = FMinTest<T>;                                        \
+  TEST_F(LlvmLibcFMinTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMinTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMinTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMinTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMinTest, Range) { testRange(&func); }

diff  --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h
new file mode 100644
index 000000000000000..6bff888294d2b0f
--- /dev/null
+++ b/libc/test/src/math/smoke/FModTest.h
@@ -0,0 +1,270 @@
+//===-- Utility class to test fmod special numbers ------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <limits>
+#include <math.h>
+
+#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception)              \
+  EXPECT_FP_EQ(expected, f(x, y));                                             \
+  EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0);                                     \
+  EXPECT_FP_EXCEPTION(expected_exception);                                     \
+  __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT)
+
+#define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)
+
+template <typename T> class FmodTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FModFunc)(T, T);
+
+  void testSpecialNumbers(FModFunc f) {
+    using nl = std::numeric_limits<T>;
+
+    // fmod (+0, y) == +0 for y != 0.
+    TEST_SPECIAL(0.0, 3.0, 0.0, false, 0);
+    TEST_SPECIAL(0.0, nl::denorm_min(), 0.0, false, 0);
+    TEST_SPECIAL(0.0, -nl::denorm_min(), 0.0, false, 0);
+    TEST_SPECIAL(0.0, nl::min(), 0.0, false, 0);
+    TEST_SPECIAL(0.0, -nl::min(), 0.0, false, 0);
+    TEST_SPECIAL(0.0, nl::max(), 0.0, false, 0);
+    TEST_SPECIAL(0.0, -nl::max(), 0.0, false, 0);
+
+    // fmod (-0, y) == -0 for y != 0.
+    TEST_SPECIAL(neg_zero, 3.0, neg_zero, false, 0);
+    TEST_SPECIAL(neg_zero, nl::denorm_min(), neg_zero, false, 0);
+    TEST_SPECIAL(neg_zero, -nl::denorm_min(), neg_zero, false, 0);
+    TEST_SPECIAL(neg_zero, nl::min(), neg_zero, false, 0);
+    TEST_SPECIAL(neg_zero, -nl::min(), neg_zero, false, 0);
+    TEST_SPECIAL(neg_zero, nl::max(), neg_zero, false, 0);
+    TEST_SPECIAL(neg_zero, -nl::max(), neg_zero, false, 0);
+
+    // fmod (+inf, y) == nl::quiet_NaN() plus invalid exception.
+    TEST_SPECIAL(inf, 3.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(inf, -1.1L, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(inf, 0.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(inf, neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(inf, nl::denorm_min(), nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(inf, nl::min(), nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(inf, nl::max(), nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(inf, inf, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(inf, neg_inf, nl::quiet_NaN(), true, FE_INVALID);
+
+    // fmod (-inf, y) == nl::quiet_NaN() plus invalid exception.
+    TEST_SPECIAL(neg_inf, 3.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_inf, -1.1L, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_inf, 0.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_inf, neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_inf, nl::denorm_min(), nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_inf, nl::min(), nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_inf, nl::max(), nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_inf, inf, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_inf, neg_inf, nl::quiet_NaN(), true, FE_INVALID);
+
+    // fmod (x, +0) == nl::quiet_NaN() plus invalid exception.
+    TEST_SPECIAL(3.0, 0.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(-1.1L, 0.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(0.0, 0.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_zero, 0.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(nl::denorm_min(), 0.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(nl::min(), 0.0, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(nl::max(), 0.0, nl::quiet_NaN(), true, FE_INVALID);
+
+    // fmod (x, -0) == nl::quiet_NaN() plus invalid exception.
+    TEST_SPECIAL(3.0, neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(-1.1L, neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(0.0, neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(neg_zero, neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(nl::denorm_min(), neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(nl::min(), neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+    TEST_SPECIAL(nl::max(), neg_zero, nl::quiet_NaN(), true, FE_INVALID);
+
+    // fmod (x, +inf) == x for x not infinite.
+    TEST_SPECIAL(0.0, inf, 0.0, false, 0);
+    TEST_SPECIAL(neg_zero, inf, neg_zero, false, 0);
+    TEST_SPECIAL(nl::denorm_min(), inf, nl::denorm_min(), false, 0);
+    TEST_SPECIAL(nl::min(), inf, nl::min(), false, 0);
+    TEST_SPECIAL(nl::max(), inf, nl::max(), false, 0);
+    TEST_SPECIAL(3.0, inf, 3.0, false, 0);
+    // fmod (x, -inf) == x for x not infinite.
+    TEST_SPECIAL(0.0, neg_inf, 0.0, false, 0);
+    TEST_SPECIAL(neg_zero, neg_inf, neg_zero, false, 0);
+    TEST_SPECIAL(nl::denorm_min(), neg_inf, nl::denorm_min(), false, 0);
+    TEST_SPECIAL(nl::min(), neg_inf, nl::min(), false, 0);
+    TEST_SPECIAL(nl::max(), neg_inf, nl::max(), false, 0);
+    TEST_SPECIAL(3.0, neg_inf, 3.0, false, 0);
+
+    TEST_SPECIAL(0.0, nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(0.0, -nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(neg_zero, nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(neg_zero, -nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(1.0, nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(1.0, -nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(inf, nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(inf, -nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(neg_inf, nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(neg_inf, -nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(0.0, nl::signaling_NaN(), nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(0.0, -nl::signaling_NaN(), nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(neg_zero, nl::signaling_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(neg_zero, -nl::signaling_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(1.0, nl::signaling_NaN(), nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(1.0, -nl::signaling_NaN(), nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(inf, nl::signaling_NaN(), nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(inf, -nl::signaling_NaN(), nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(neg_inf, nl::signaling_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(neg_inf, -nl::signaling_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(nl::quiet_NaN(), 0.0, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(-nl::quiet_NaN(), 0.0, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(nl::quiet_NaN(), neg_zero, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(-nl::quiet_NaN(), neg_zero, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(nl::quiet_NaN(), 1.0, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(-nl::quiet_NaN(), 1.0, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(nl::quiet_NaN(), inf, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(-nl::quiet_NaN(), inf, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(nl::quiet_NaN(), neg_inf, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(-nl::quiet_NaN(), neg_inf, nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(nl::signaling_NaN(), 0.0, nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), 0.0, nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(nl::signaling_NaN(), neg_zero, nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), neg_zero, nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(nl::signaling_NaN(), 1.0, nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), 1.0, nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(nl::signaling_NaN(), inf, nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), inf, nl::quiet_NaN(), false, FE_INVALID);
+    TEST_SPECIAL(nl::signaling_NaN(), neg_inf, nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), neg_inf, nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(nl::quiet_NaN(), nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(nl::quiet_NaN(), -nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(-nl::quiet_NaN(), nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(-nl::quiet_NaN(), -nl::quiet_NaN(), nl::quiet_NaN(), false, 0);
+    TEST_SPECIAL(nl::quiet_NaN(), nl::signaling_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(nl::quiet_NaN(), -nl::signaling_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(-nl::quiet_NaN(), nl::signaling_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(-nl::quiet_NaN(), -nl::signaling_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(nl::signaling_NaN(), nl::quiet_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(nl::signaling_NaN(), -nl::quiet_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), nl::quiet_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), -nl::quiet_NaN(), nl::quiet_NaN(), false,
+                 FE_INVALID);
+    TEST_SPECIAL(nl::signaling_NaN(), nl::signaling_NaN(), nl::quiet_NaN(),
+                 false, FE_INVALID);
+    TEST_SPECIAL(nl::signaling_NaN(), -nl::signaling_NaN(), nl::quiet_NaN(),
+                 false, FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), nl::signaling_NaN(), nl::quiet_NaN(),
+                 false, FE_INVALID);
+    TEST_SPECIAL(-nl::signaling_NaN(), -nl::signaling_NaN(), nl::quiet_NaN(),
+                 false, FE_INVALID);
+
+    TEST_SPECIAL(6.5, 2.25L, 2.0L, false, 0);
+    TEST_SPECIAL(-6.5, 2.25L, -2.0L, false, 0);
+    TEST_SPECIAL(6.5, -2.25L, 2.0L, false, 0);
+    TEST_SPECIAL(-6.5, -2.25L, -2.0L, false, 0);
+
+    TEST_SPECIAL(nl::max(), nl::max(), 0.0, false, 0);
+    TEST_SPECIAL(nl::max(), -nl::max(), 0.0, false, 0);
+    TEST_SPECIAL(nl::max(), nl::min(), 0.0, false, 0);
+    TEST_SPECIAL(nl::max(), -nl::min(), 0.0, false, 0);
+    TEST_SPECIAL(nl::max(), nl::denorm_min(), 0.0, false, 0);
+    TEST_SPECIAL(nl::max(), -nl::denorm_min(), 0.0, false, 0);
+    TEST_SPECIAL(-nl::max(), nl::max(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::max(), -nl::max(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::max(), nl::min(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::max(), -nl::min(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::max(), nl::denorm_min(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::max(), -nl::denorm_min(), neg_zero, false, 0);
+
+    TEST_SPECIAL(nl::min(), nl::max(), nl::min(), false, 0);
+    TEST_SPECIAL(nl::min(), -nl::max(), nl::min(), false, 0);
+    TEST_SPECIAL(nl::min(), nl::min(), 0.0, false, 0);
+    TEST_SPECIAL(nl::min(), -nl::min(), 0.0, false, 0);
+    TEST_SPECIAL(nl::min(), nl::denorm_min(), 0.0, false, 0);
+    TEST_SPECIAL(nl::min(), -nl::denorm_min(), 0.0, false, 0);
+    TEST_SPECIAL(-nl::min(), nl::max(), -nl::min(), false, 0);
+    TEST_SPECIAL(-nl::min(), -nl::max(), -nl::min(), false, 0);
+    TEST_SPECIAL(-nl::min(), nl::min(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::min(), -nl::min(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::min(), nl::denorm_min(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::min(), -nl::denorm_min(), neg_zero, false, 0);
+
+    TEST_SPECIAL(nl::denorm_min(), nl::max(), nl::denorm_min(), false, 0);
+    TEST_SPECIAL(nl::denorm_min(), -nl::max(), nl::denorm_min(), false, 0);
+    TEST_SPECIAL(nl::denorm_min(), nl::min(), nl::denorm_min(), false, 0);
+    TEST_SPECIAL(nl::denorm_min(), -nl::min(), nl::denorm_min(), false, 0);
+    TEST_SPECIAL(nl::denorm_min(), nl::denorm_min(), 0.0, false, 0);
+    TEST_SPECIAL(nl::denorm_min(), -nl::denorm_min(), 0.0, false, 0);
+    TEST_SPECIAL(-nl::denorm_min(), nl::max(), -nl::denorm_min(), false, 0);
+    TEST_SPECIAL(-nl::denorm_min(), -nl::max(), -nl::denorm_min(), false, 0);
+    TEST_SPECIAL(-nl::denorm_min(), nl::min(), -nl::denorm_min(), false, 0);
+    TEST_SPECIAL(-nl::denorm_min(), -nl::min(), -nl::denorm_min(), false, 0);
+    TEST_SPECIAL(-nl::denorm_min(), nl::denorm_min(), neg_zero, false, 0);
+    TEST_SPECIAL(-nl::denorm_min(), -nl::denorm_min(), neg_zero, false, 0);
+  }
+
+  void testRegularExtreme(FModFunc f) {
+
+    TEST_REGULAR(0x1p127L, 0x3p-149L, 0x1p-149L);
+    TEST_REGULAR(0x1p127L, -0x3p-149L, 0x1p-149L);
+    TEST_REGULAR(0x1p127L, 0x3p-148L, 0x1p-147L);
+    TEST_REGULAR(0x1p127L, -0x3p-148L, 0x1p-147L);
+    TEST_REGULAR(0x1p127L, 0x3p-126L, 0x1p-125L);
+    TEST_REGULAR(0x1p127L, -0x3p-126L, 0x1p-125L);
+    TEST_REGULAR(-0x1p127L, 0x3p-149L, -0x1p-149L);
+    TEST_REGULAR(-0x1p127L, -0x3p-149L, -0x1p-149L);
+    TEST_REGULAR(-0x1p127L, 0x3p-148L, -0x1p-147L);
+    TEST_REGULAR(-0x1p127L, -0x3p-148L, -0x1p-147L);
+    TEST_REGULAR(-0x1p127L, 0x3p-126L, -0x1p-125L);
+    TEST_REGULAR(-0x1p127L, -0x3p-126L, -0x1p-125L);
+
+    if constexpr (sizeof(T) >= sizeof(double)) {
+      TEST_REGULAR(0x1p1023L, 0x3p-1074L, 0x1p-1073L);
+      TEST_REGULAR(0x1p1023L, -0x3p-1074L, 0x1p-1073L);
+      TEST_REGULAR(0x1p1023L, 0x3p-1073L, 0x1p-1073L);
+      TEST_REGULAR(0x1p1023L, -0x3p-1073L, 0x1p-1073L);
+      TEST_REGULAR(0x1p1023L, 0x3p-1022L, 0x1p-1021L);
+      TEST_REGULAR(0x1p1023L, -0x3p-1022L, 0x1p-1021L);
+      TEST_REGULAR(-0x1p1023L, 0x3p-1074L, -0x1p-1073L);
+      TEST_REGULAR(-0x1p1023L, -0x3p-1074L, -0x1p-1073L);
+      TEST_REGULAR(-0x1p1023L, 0x3p-1073L, -0x1p-1073L);
+      TEST_REGULAR(-0x1p1023L, -0x3p-1073L, -0x1p-1073L);
+      TEST_REGULAR(-0x1p1023L, 0x3p-1022L, -0x1p-1021L);
+      TEST_REGULAR(-0x1p1023L, -0x3p-1022L, -0x1p-1021L);
+    }
+  }
+};
+
+#define LIST_FMOD_TESTS(T, func)                                               \
+  using LlvmLibcFmodTest = FmodTest<T>;                                        \
+  TEST_F(LlvmLibcFmodTest, SpecialNumbers) { testSpecialNumbers(&func); }      \
+  TEST_F(LlvmLibcFmodTest, RegularExtreme) { testRegularExtreme(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H

diff  --git a/libc/test/src/math/smoke/FloorTest.h b/libc/test/src/math/smoke/FloorTest.h
new file mode 100644
index 000000000000000..b1125b0517e5e3c
--- /dev/null
+++ b/libc/test/src/math/smoke/FloorTest.h
@@ -0,0 +1,68 @@
+//===-- Utility class to test floor[f|l] ------------------------*- C++ -*-===//
+//
+// 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 "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class FloorTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FloorFunc)(T);
+
+  void testSpecialNumbers(FloorFunc func) {
+    EXPECT_FP_EQ(zero, func(zero));
+    EXPECT_FP_EQ(neg_zero, func(neg_zero));
+
+    EXPECT_FP_EQ(inf, func(inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf));
+
+    EXPECT_FP_EQ(aNaN, func(aNaN));
+  }
+
+  void testRoundedNumbers(FloorFunc func) {
+    EXPECT_FP_EQ(T(1.0), func(T(1.0)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.0)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.0)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.0)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.0)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.0)));
+  }
+
+  void testFractions(FloorFunc func) {
+    EXPECT_FP_EQ(T(0.0), func(T(0.5)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-0.5)));
+    EXPECT_FP_EQ(T(0.0), func(T(0.115)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-0.115)));
+    EXPECT_FP_EQ(T(0.0), func(T(0.715)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-0.715)));
+    EXPECT_FP_EQ(T(1.0), func(T(1.3)));
+    EXPECT_FP_EQ(T(-2.0), func(T(-1.3)));
+    EXPECT_FP_EQ(T(1.0), func(T(1.5)));
+    EXPECT_FP_EQ(T(-2.0), func(T(-1.5)));
+    EXPECT_FP_EQ(T(1.0), func(T(1.75)));
+    EXPECT_FP_EQ(T(-2.0), func(T(-1.75)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.32)));
+    EXPECT_FP_EQ(T(-11.0), func(T(-10.32)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.65)));
+    EXPECT_FP_EQ(T(-11.0), func(T(-10.65)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.38)));
+    EXPECT_FP_EQ(T(-1235.0), func(T(-1234.38)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.96)));
+    EXPECT_FP_EQ(T(-1235.0), func(T(-1234.96)));
+  }
+};
+
+#define LIST_FLOOR_TESTS(T, func)                                              \
+  using LlvmLibcFloorTest = FloorTest<T>;                                      \
+  TEST_F(LlvmLibcFloorTest, SpecialNumbers) { testSpecialNumbers(&func); }     \
+  TEST_F(LlvmLibcFloorTest, RoundedNubmers) { testRoundedNumbers(&func); }     \
+  TEST_F(LlvmLibcFloorTest, Fractions) { testFractions(&func); }

diff  --git a/libc/test/src/math/smoke/FmaTest.h b/libc/test/src/math/smoke/FmaTest.h
new file mode 100644
index 000000000000000..d276dba4291a67d
--- /dev/null
+++ b/libc/test/src/math/smoke/FmaTest.h
@@ -0,0 +1,57 @@
+//===-- Utility class to test 
diff erent flavors of fma --------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_FMATEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_FMATEST_H
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename T>
+class FmaTestTemplate : public __llvm_libc::testing::Test {
+private:
+  using Func = T (*)(T, T, T);
+  using FPBits = __llvm_libc::fputil::FPBits<T>;
+  using UIntType = typename FPBits::UIntType;
+  const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
+  const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
+  const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
+  const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
+  const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
+
+public:
+  void test_special_numbers(Func func) {
+    EXPECT_FP_EQ(func(zero, zero, zero), zero);
+    EXPECT_FP_EQ(func(zero, neg_zero, neg_zero), neg_zero);
+    EXPECT_FP_EQ(func(inf, inf, zero), inf);
+    EXPECT_FP_EQ(func(neg_inf, inf, neg_inf), neg_inf);
+    EXPECT_FP_EQ(func(inf, zero, zero), nan);
+    EXPECT_FP_EQ(func(inf, neg_inf, inf), nan);
+    EXPECT_FP_EQ(func(nan, zero, inf), nan);
+    EXPECT_FP_EQ(func(inf, neg_inf, nan), nan);
+
+    // Test underflow rounding up.
+    EXPECT_FP_EQ(func(T(0.5), T(FPBits(FPBits::MIN_SUBNORMAL)),
+                      T(FPBits(FPBits::MIN_SUBNORMAL))),
+                 T(FPBits(UIntType(2))));
+    // Test underflow rounding down.
+    T v = T(FPBits(FPBits::MIN_NORMAL + UIntType(1)));
+    EXPECT_FP_EQ(func(T(1) / T(FPBits::MIN_NORMAL << 1), v,
+                      T(FPBits(FPBits::MIN_NORMAL))),
+                 v);
+    // Test overflow.
+    T z = T(FPBits(FPBits::MAX_NORMAL));
+    EXPECT_FP_EQ(func(T(1.75), z, -z), T(0.75) * z);
+    // Exact cancellation.
+    EXPECT_FP_EQ(func(T(3.0), T(5.0), -T(15.0)), T(0.0));
+    EXPECT_FP_EQ(func(T(-3.0), T(5.0), T(15.0)), T(0.0));
+  }
+};
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_FMATEST_H

diff  --git a/libc/test/src/math/smoke/FrexpTest.h b/libc/test/src/math/smoke/FrexpTest.h
new file mode 100644
index 000000000000000..7a3a948912bb873
--- /dev/null
+++ b/libc/test/src/math/smoke/FrexpTest.h
@@ -0,0 +1,96 @@
+//===-- Utility class to test frexp[f|l] ------------------------*- C++ -*-===//
+//
+// 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/__support/FPUtil/BasicOperations.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class FrexpTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+  static constexpr UIntType HIDDEN_BIT =
+      UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+
+public:
+  typedef T (*FrexpFunc)(T, int *);
+
+  void testSpecialNumbers(FrexpFunc func) {
+    int exponent;
+    ASSERT_FP_EQ(aNaN, func(aNaN, &exponent));
+    ASSERT_FP_EQ(inf, func(inf, &exponent));
+    ASSERT_FP_EQ(neg_inf, func(neg_inf, &exponent));
+
+    ASSERT_FP_EQ(0.0, func(0.0, &exponent));
+    ASSERT_EQ(exponent, 0);
+
+    ASSERT_FP_EQ(-0.0, func(-0.0, &exponent));
+    ASSERT_EQ(exponent, 0);
+  }
+
+  void testPowersOfTwo(FrexpFunc func) {
+    int exponent;
+
+    EXPECT_FP_EQ(T(0.5), func(T(1.0), &exponent));
+    EXPECT_EQ(exponent, 1);
+    EXPECT_FP_EQ(T(-0.5), func(T(-1.0), &exponent));
+    EXPECT_EQ(exponent, 1);
+
+    EXPECT_FP_EQ(T(0.5), func(T(2.0), &exponent));
+    EXPECT_EQ(exponent, 2);
+    EXPECT_FP_EQ(T(-0.5), func(T(-2.0), &exponent));
+    EXPECT_EQ(exponent, 2);
+
+    EXPECT_FP_EQ(T(0.5), func(T(4.0), &exponent));
+    EXPECT_EQ(exponent, 3);
+    EXPECT_FP_EQ(T(-0.5), func(T(-4.0), &exponent));
+    EXPECT_EQ(exponent, 3);
+
+    EXPECT_FP_EQ(T(0.5), func(T(8.0), &exponent));
+    EXPECT_EQ(exponent, 4);
+    EXPECT_FP_EQ(T(-0.5), func(T(-8.0), &exponent));
+    EXPECT_EQ(exponent, 4);
+
+    EXPECT_FP_EQ(T(0.5), func(T(16.0), &exponent));
+    EXPECT_EQ(exponent, 5);
+    EXPECT_FP_EQ(T(-0.5), func(T(-16.0), &exponent));
+    EXPECT_EQ(exponent, 5);
+
+    EXPECT_FP_EQ(T(0.5), func(T(32.0), &exponent));
+    EXPECT_EQ(exponent, 6);
+    EXPECT_FP_EQ(T(-0.5), func(T(-32.0), &exponent));
+    EXPECT_EQ(exponent, 6);
+  }
+
+  void testSomeIntegers(FrexpFunc func) {
+    int exponent;
+
+    EXPECT_FP_EQ(T(0.75), func(T(24.0), &exponent));
+    EXPECT_EQ(exponent, 5);
+    EXPECT_FP_EQ(T(-0.75), func(T(-24.0), &exponent));
+    EXPECT_EQ(exponent, 5);
+
+    EXPECT_FP_EQ(T(0.625), func(T(40.0), &exponent));
+    EXPECT_EQ(exponent, 6);
+    EXPECT_FP_EQ(T(-0.625), func(T(-40.0), &exponent));
+    EXPECT_EQ(exponent, 6);
+
+    EXPECT_FP_EQ(T(0.78125), func(T(800.0), &exponent));
+    EXPECT_EQ(exponent, 10);
+    EXPECT_FP_EQ(T(-0.78125), func(T(-800.0), &exponent));
+    EXPECT_EQ(exponent, 10);
+  }
+};
+
+#define LIST_FREXP_TESTS(T, func)                                              \
+  using LlvmLibcFrexpTest = FrexpTest<T>;                                      \
+  TEST_F(LlvmLibcFrexpTest, SpecialNumbers) { testSpecialNumbers(&func); }     \
+  TEST_F(LlvmLibcFrexpTest, PowersOfTwo) { testPowersOfTwo(&func); }           \
+  TEST_F(LlvmLibcFrexpTest, SomeIntegers) { testSomeIntegers(&func); }\

diff  --git a/libc/test/src/math/smoke/HypotTest.h b/libc/test/src/math/smoke/HypotTest.h
new file mode 100644
index 000000000000000..084dbc4d83d750b
--- /dev/null
+++ b/libc/test/src/math/smoke/HypotTest.h
@@ -0,0 +1,60 @@
+//===-- Utility class to test 
diff erent flavors of hypot ------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_HYPOTTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_HYPOTTEST_H
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T>
+class HypotTestTemplate : public __llvm_libc::testing::Test {
+private:
+  using Func = T (*)(T, T);
+  using FPBits = __llvm_libc::fputil::FPBits<T>;
+  using UIntType = typename FPBits::UIntType;
+  const T nan = T(FPBits::build_quiet_nan(1));
+  const T inf = T(FPBits::inf());
+  const T neg_inf = T(FPBits::neg_inf());
+  const T zero = T(FPBits::zero());
+  const T neg_zero = T(FPBits::neg_zero());
+  const T max_normal = T(FPBits(FPBits::MAX_NORMAL));
+  const T min_normal = T(FPBits(FPBits::MIN_NORMAL));
+  const T max_subnormal = T(FPBits(FPBits::MAX_SUBNORMAL));
+  const T min_subnormal = T(FPBits(FPBits::MIN_SUBNORMAL));
+
+public:
+  void test_special_numbers(Func func) {
+    constexpr int N = 4;
+    // Pythagorean triples.
+    constexpr T PYT[N][3] = {{3, 4, 5}, {5, 12, 13}, {8, 15, 17}, {7, 24, 25}};
+
+    EXPECT_FP_EQ(func(inf, nan), inf);
+    EXPECT_FP_EQ(func(nan, neg_inf), inf);
+    EXPECT_FP_EQ(func(nan, nan), nan);
+    EXPECT_FP_EQ(func(nan, zero), nan);
+    EXPECT_FP_EQ(func(neg_zero, nan), nan);
+
+    for (int i = 0; i < N; ++i) {
+      EXPECT_FP_EQ_ALL_ROUNDING(PYT[i][2], func(PYT[i][0], PYT[i][1]));
+      EXPECT_FP_EQ_ALL_ROUNDING(PYT[i][2], func(-PYT[i][0], PYT[i][1]));
+      EXPECT_FP_EQ_ALL_ROUNDING(PYT[i][2], func(PYT[i][0], -PYT[i][1]));
+      EXPECT_FP_EQ_ALL_ROUNDING(PYT[i][2], func(-PYT[i][0], -PYT[i][1]));
+
+      EXPECT_FP_EQ_ALL_ROUNDING(PYT[i][2], func(PYT[i][1], PYT[i][0]));
+      EXPECT_FP_EQ_ALL_ROUNDING(PYT[i][2], func(-PYT[i][1], PYT[i][0]));
+      EXPECT_FP_EQ_ALL_ROUNDING(PYT[i][2], func(PYT[i][1], -PYT[i][0]));
+      EXPECT_FP_EQ_ALL_ROUNDING(PYT[i][2], func(-PYT[i][1], -PYT[i][0]));
+    }
+  }
+};
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_HYPOTTEST_H

diff  --git a/libc/test/src/math/smoke/ILogbTest.h b/libc/test/src/math/smoke/ILogbTest.h
new file mode 100644
index 000000000000000..6ad5eb065c8aa44
--- /dev/null
+++ b/libc/test/src/math/smoke/ILogbTest.h
@@ -0,0 +1,115 @@
+//===-- Utility class to test 
diff erent flavors of ilogb --------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <limits.h>
+
+class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
+public:
+  template <typename T> struct ILogbFunc {
+    typedef int (*Func)(T);
+  };
+
+  template <typename T>
+  void test_special_numbers(typename ILogbFunc<T>::Func func) {
+    EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::zero())));
+    EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::neg_zero())));
+
+    EXPECT_EQ(FP_ILOGBNAN,
+              func(T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1))));
+
+    EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::inf())));
+    EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::neg_inf())));
+  }
+
+  template <typename T>
+  void test_powers_of_two(typename ILogbFunc<T>::Func func) {
+    EXPECT_EQ(0, func(T(1.0)));
+    EXPECT_EQ(0, func(T(-1.0)));
+
+    EXPECT_EQ(1, func(T(2.0)));
+    EXPECT_EQ(1, func(T(-2.0)));
+
+    EXPECT_EQ(2, func(T(4.0)));
+    EXPECT_EQ(2, func(T(-4.0)));
+
+    EXPECT_EQ(3, func(T(8.0)));
+    EXPECT_EQ(3, func(-8.0));
+
+    EXPECT_EQ(4, func(16.0));
+    EXPECT_EQ(4, func(-16.0));
+
+    EXPECT_EQ(5, func(32.0));
+    EXPECT_EQ(5, func(-32.0));
+  }
+
+  template <typename T>
+  void test_some_integers(typename ILogbFunc<T>::Func func) {
+    EXPECT_EQ(1, func(T(3.0)));
+    EXPECT_EQ(1, func(T(-3.0)));
+
+    EXPECT_EQ(2, func(T(7.0)));
+    EXPECT_EQ(2, func(T(-7.0)));
+
+    EXPECT_EQ(3, func(T(10.0)));
+    EXPECT_EQ(3, func(T(-10.0)));
+
+    EXPECT_EQ(4, func(T(31.0)));
+    EXPECT_EQ(4, func(-31.0));
+
+    EXPECT_EQ(5, func(55.0));
+    EXPECT_EQ(5, func(-55.0));
+  }
+
+  template <typename T>
+  void test_subnormal_range(typename ILogbFunc<T>::Func func) {
+    using FPBits = __llvm_libc::fputil::FPBits<T>;
+    using UIntType = typename FPBits::UIntType;
+    constexpr UIntType COUNT = 10'001;
+    constexpr UIntType STEP =
+        (UIntType(FPBits::MAX_SUBNORMAL) - UIntType(FPBits::MIN_SUBNORMAL)) /
+        COUNT;
+    for (UIntType v = FPBits::MIN_SUBNORMAL; v <= FPBits::MAX_SUBNORMAL;
+         v += STEP) {
+      T x = T(FPBits(v));
+      if (isnan(x) || isinf(x) || x == 0.0)
+        continue;
+
+      int exponent;
+      __llvm_libc::fputil::frexp(x, exponent);
+      ASSERT_EQ(exponent, func(x) + 1);
+    }
+  }
+
+  template <typename T>
+  void test_normal_range(typename ILogbFunc<T>::Func func) {
+    using FPBits = __llvm_libc::fputil::FPBits<T>;
+    using UIntType = typename FPBits::UIntType;
+    constexpr UIntType COUNT = 10'001;
+    constexpr UIntType STEP =
+        (UIntType(FPBits::MAX_NORMAL) - UIntType(FPBits::MIN_NORMAL)) / COUNT;
+    for (UIntType v = FPBits::MIN_NORMAL; v <= FPBits::MAX_NORMAL; v += STEP) {
+      T x = T(FPBits(v));
+      if (isnan(x) || isinf(x) || x == 0.0)
+        continue;
+
+      int exponent;
+      __llvm_libc::fputil::frexp(x, exponent);
+      ASSERT_EQ(exponent, func(x) + 1);
+    }
+  }
+};
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H

diff  --git a/libc/test/src/math/smoke/LdExpTest.h b/libc/test/src/math/smoke/LdExpTest.h
new file mode 100644
index 000000000000000..2e592995ae792e9
--- /dev/null
+++ b/libc/test/src/math/smoke/LdExpTest.h
@@ -0,0 +1,166 @@
+//===-- Utility class to test 
diff erent flavors of ldexp --------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/NormalFloat.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <limits.h>
+#include <math.h>
+#include <stdint.h>
+
+template <typename T>
+class LdExpTestTemplate : public __llvm_libc::testing::Test {
+  using FPBits = __llvm_libc::fputil::FPBits<T>;
+  using NormalFloat = __llvm_libc::fputil::NormalFloat<T>;
+  using UIntType = typename FPBits::UIntType;
+  static constexpr UIntType MANTISSA_WIDTH =
+      __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+  // A normalized mantissa to be used with tests.
+  static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234;
+
+  const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
+  const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
+  const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
+  const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
+  const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
+
+public:
+  typedef T (*LdExpFunc)(T, int);
+
+  void testSpecialNumbers(LdExpFunc func) {
+    int exp_array[5] = {-INT_MAX - 1, -10, 0, 10, INT_MAX};
+    for (int exp : exp_array) {
+      ASSERT_FP_EQ(zero, func(zero, exp));
+      ASSERT_FP_EQ(neg_zero, func(neg_zero, exp));
+      ASSERT_FP_EQ(inf, func(inf, exp));
+      ASSERT_FP_EQ(neg_inf, func(neg_inf, exp));
+      ASSERT_FP_EQ(nan, func(nan, exp));
+    }
+  }
+
+  void testPowersOfTwo(LdExpFunc func) {
+    int32_t exp_array[5] = {1, 2, 3, 4, 5};
+    int32_t val_array[6] = {1, 2, 4, 8, 16, 32};
+    for (int32_t exp : exp_array) {
+      for (int32_t val : val_array) {
+        ASSERT_FP_EQ(T(val << exp), func(T(val), exp));
+        ASSERT_FP_EQ(T(-1 * (val << exp)), func(T(-val), exp));
+      }
+    }
+  }
+
+  void testOverflow(LdExpFunc func) {
+    NormalFloat x(FPBits::MAX_EXPONENT - 10, NormalFloat::ONE + 0xF00BA, 0);
+    for (int32_t exp = 10; exp < 100; ++exp) {
+      ASSERT_FP_EQ(inf, func(T(x), exp));
+      ASSERT_FP_EQ(neg_inf, func(-T(x), exp));
+    }
+  }
+
+  void testUnderflowToZeroOnNormal(LdExpFunc func) {
+    // In this test, we pass a normal nubmer to func and expect zero
+    // to be returned due to underflow.
+    int32_t base_exponent = FPBits::EXPONENT_BIAS + int32_t(MANTISSA_WIDTH);
+    int32_t exp_array[] = {base_exponent + 5, base_exponent + 4,
+                           base_exponent + 3, base_exponent + 2,
+                           base_exponent + 1};
+    T x = NormalFloat(0, MANTISSA, 0);
+    for (int32_t exp : exp_array) {
+      ASSERT_FP_EQ(func(x, -exp), x > 0 ? zero : neg_zero);
+    }
+  }
+
+  void testUnderflowToZeroOnSubnormal(LdExpFunc func) {
+    // In this test, we pass a normal nubmer to func and expect zero
+    // to be returned due to underflow.
+    int32_t base_exponent = FPBits::EXPONENT_BIAS + int32_t(MANTISSA_WIDTH);
+    int32_t exp_array[] = {base_exponent + 5, base_exponent + 4,
+                           base_exponent + 3, base_exponent + 2,
+                           base_exponent + 1};
+    T x = NormalFloat(-FPBits::EXPONENT_BIAS, MANTISSA, 0);
+    for (int32_t exp : exp_array) {
+      ASSERT_FP_EQ(func(x, -exp), x > 0 ? zero : neg_zero);
+    }
+  }
+
+  void testNormalOperation(LdExpFunc func) {
+    T val_array[] = {
+        // Normal numbers
+        NormalFloat(100, MANTISSA, 0), NormalFloat(-100, MANTISSA, 0),
+        NormalFloat(100, MANTISSA, 1), NormalFloat(-100, MANTISSA, 1),
+        // Subnormal numbers
+        NormalFloat(-FPBits::EXPONENT_BIAS, MANTISSA, 0),
+        NormalFloat(-FPBits::EXPONENT_BIAS, MANTISSA, 1)};
+    for (int32_t exp = 0; exp <= static_cast<int32_t>(MANTISSA_WIDTH); ++exp) {
+      for (T x : val_array) {
+        // We compare the result of ldexp with the result
+        // of the native multiplication/division instruction.
+
+        // We need to use a NormalFloat here (instead of 1 << exp), because
+        // there are 32 bit systems that don't support 128bit long ints but
+        // support long doubles. This test can do 1 << 64, which would fail
+        // in these systems.
+        NormalFloat two_to_exp = NormalFloat(static_cast<T>(1.L));
+        two_to_exp = two_to_exp.mul2(exp);
+
+        ASSERT_FP_EQ(func(x, exp), x * two_to_exp);
+        ASSERT_FP_EQ(func(x, -exp), x / two_to_exp);
+      }
+    }
+
+    // Normal which trigger mantissa overflow.
+    T x = NormalFloat(-FPBits::EXPONENT_BIAS + 1,
+                      UIntType(2) * NormalFloat::ONE - UIntType(1), 0);
+    ASSERT_FP_EQ(func(x, -1), x / 2);
+    ASSERT_FP_EQ(func(-x, -1), -x / 2);
+
+    // Start with a normal number high exponent but pass a very low number for
+    // exp. The result should be a subnormal number.
+    x = NormalFloat(FPBits::EXPONENT_BIAS, NormalFloat::ONE, 0);
+    int exp = -FPBits::MAX_EXPONENT - 5;
+    T result = func(x, exp);
+    FPBits result_bits(result);
+    ASSERT_FALSE(result_bits.is_zero());
+    // Verify that the result is indeed subnormal.
+    ASSERT_EQ(result_bits.get_unbiased_exponent(), uint16_t(0));
+    // But if the exp is so less that normalization leads to zero, then
+    // the result should be zero.
+    result = func(x, -FPBits::MAX_EXPONENT - int(MANTISSA_WIDTH) - 5);
+    ASSERT_TRUE(FPBits(result).is_zero());
+
+    // Start with a subnormal number but pass a very high number for exponent.
+    // The result should not be infinity.
+    x = NormalFloat(-FPBits::EXPONENT_BIAS + 1, NormalFloat::ONE >> 10, 0);
+    exp = FPBits::MAX_EXPONENT + 5;
+    ASSERT_FALSE(FPBits(func(x, exp)).is_inf());
+    // But if the exp is large enough to oversome than the normalization shift,
+    // then it should result in infinity.
+    exp = FPBits::MAX_EXPONENT + 15;
+    ASSERT_FP_EQ(func(x, exp), inf);
+  }
+};
+
+#define LIST_LDEXP_TESTS(T, func)                                              \
+  using LlvmLibcLdExpTest = LdExpTestTemplate<T>;                              \
+  TEST_F(LlvmLibcLdExpTest, SpecialNumbers) { testSpecialNumbers(&func); }     \
+  TEST_F(LlvmLibcLdExpTest, PowersOfTwo) { testPowersOfTwo(&func); }           \
+  TEST_F(LlvmLibcLdExpTest, OverFlow) { testOverflow(&func); }                 \
+  TEST_F(LlvmLibcLdExpTest, UnderflowToZeroOnNormal) {                         \
+    testUnderflowToZeroOnNormal(&func);                                        \
+  }                                                                            \
+  TEST_F(LlvmLibcLdExpTest, UnderflowToZeroOnSubnormal) {                      \
+    testUnderflowToZeroOnSubnormal(&func);                                     \
+  }                                                                            \
+  TEST_F(LlvmLibcLdExpTest, NormalOperation) { testNormalOperation(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H

diff  --git a/libc/test/src/math/smoke/LogbTest.h b/libc/test/src/math/smoke/LogbTest.h
new file mode 100644
index 000000000000000..885bd7c8a6371c3
--- /dev/null
+++ b/libc/test/src/math/smoke/LogbTest.h
@@ -0,0 +1,91 @@
+//===-- Utility class to test logb[f|l] -------------------------*- C++ -*-===//
+//
+// 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/__support/FPUtil/ManipulationFunctions.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class LogbTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+  static constexpr UIntType HIDDEN_BIT =
+      UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+
+public:
+  typedef T (*LogbFunc)(T);
+
+  void testSpecialNumbers(LogbFunc func) {
+    ASSERT_FP_EQ(aNaN, func(aNaN));
+    ASSERT_FP_EQ(inf, func(inf));
+    ASSERT_FP_EQ(inf, func(neg_inf));
+    ASSERT_FP_EQ(neg_inf, func(0.0));
+    ASSERT_FP_EQ(neg_inf, func(-0.0));
+  }
+
+  void testPowersOfTwo(LogbFunc func) {
+    EXPECT_FP_EQ(T(0.0), func(T(1.0)));
+    EXPECT_FP_EQ(T(0.0), func(T(-1.0)));
+
+    EXPECT_FP_EQ(T(1.0), func(T(2.0)));
+    EXPECT_FP_EQ(T(1.0), func(T(-2.0)));
+
+    EXPECT_FP_EQ(T(2.0), func(T(4.0)));
+    EXPECT_FP_EQ(T(2.0), func(T(-4.0)));
+
+    EXPECT_FP_EQ(T(3.0), func(T(8.0)));
+    EXPECT_FP_EQ(T(3.0), func(T(-8.0)));
+
+    EXPECT_FP_EQ(T(4.0), func(T(16.0)));
+    EXPECT_FP_EQ(T(4.0), func(T(-16.0)));
+
+    EXPECT_FP_EQ(T(5.0), func(T(32.0)));
+    EXPECT_FP_EQ(T(5.0), func(T(-32.0)));
+  }
+
+  void testSomeIntegers(LogbFunc func) {
+    EXPECT_FP_EQ(T(1.0), func(T(3.0)));
+    EXPECT_FP_EQ(T(1.0), func(T(-3.0)));
+
+    EXPECT_FP_EQ(T(2.0), func(T(7.0)));
+    EXPECT_FP_EQ(T(2.0), func(T(-7.0)));
+
+    EXPECT_FP_EQ(T(3.0), func(T(10.0)));
+    EXPECT_FP_EQ(T(3.0), func(T(-10.0)));
+
+    EXPECT_FP_EQ(T(4.0), func(T(31.0)));
+    EXPECT_FP_EQ(T(4.0), func(T(-31.0)));
+
+    EXPECT_FP_EQ(T(5.0), func(T(55.0)));
+    EXPECT_FP_EQ(T(5.0), func(T(-55.0)));
+  }
+
+  void testRange(LogbFunc func) {
+    using UIntType = typename FPBits::UIntType;
+    constexpr UIntType COUNT = 100'000;
+    constexpr UIntType STEP = UIntType(-1) / COUNT;
+    for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
+      T x = static_cast<T>(FPBits(v));
+      if (isnan(x) || isinf(x) || x == 0.0l)
+        continue;
+
+      int exponent;
+      __llvm_libc::fputil::frexp(x, exponent);
+      ASSERT_FP_EQ(T(exponent), func(x) + T(1.0));
+    }
+  }
+};
+
+#define LIST_LOGB_TESTS(T, func)                                               \
+  using LlvmLibcLogbTest = LogbTest<T>;                                        \
+  TEST_F(LlvmLibcLogbTest, SpecialNumbers) { testSpecialNumbers(&func); }      \
+  TEST_F(LlvmLibcLogbTest, PowersOfTwo) { testPowersOfTwo(&func); }            \
+  TEST_F(LlvmLibcLogbTest, SomeIntegers) { testSomeIntegers(&func); }          \
+  TEST_F(LlvmLibcLogbTest, InRange) { testRange(&func); }

diff  --git a/libc/test/src/math/smoke/ModfTest.h b/libc/test/src/math/smoke/ModfTest.h
new file mode 100644
index 000000000000000..687d0dd74ab67bf
--- /dev/null
+++ b/libc/test/src/math/smoke/ModfTest.h
@@ -0,0 +1,105 @@
+//===-- Utility class to test floor[f|l] ------------------------*- C++ -*-===//
+//
+// 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/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class ModfTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*ModfFunc)(T, T *);
+
+  void testSpecialNumbers(ModfFunc func) {
+    T integral;
+
+    EXPECT_FP_EQ(zero, func(zero, &integral));
+    EXPECT_FP_EQ(integral, zero);
+    EXPECT_FP_EQ(neg_zero, func(neg_zero, &integral));
+    EXPECT_FP_EQ(integral, neg_zero);
+
+    EXPECT_FP_EQ(zero, func(inf, &integral));
+    EXPECT_FP_EQ(inf, integral);
+    EXPECT_FP_EQ(neg_zero, func(neg_inf, &integral));
+    EXPECT_FP_EQ(neg_inf, integral);
+
+    EXPECT_FP_EQ(aNaN, func(aNaN, &integral));
+  }
+
+  void testIntegers(ModfFunc func) {
+    T integral;
+
+    EXPECT_FP_EQ(T(0.0), func(T(1.0), &integral));
+    EXPECT_FP_EQ(T(1.0), integral);
+
+    EXPECT_FP_EQ(T(-0.0), func(T(-1.0), &integral));
+    EXPECT_FP_EQ(T(-1.0), integral);
+
+    EXPECT_FP_EQ(T(0.0), func(T(10.0), &integral));
+    EXPECT_FP_EQ(T(10.0), integral);
+
+    EXPECT_FP_EQ(T(-0.0), func(T(-10.0), &integral));
+    EXPECT_FP_EQ(T(-10.0), integral);
+
+    EXPECT_FP_EQ(T(0.0), func(T(12345.0), &integral));
+    EXPECT_FP_EQ(T(12345.0), integral);
+
+    EXPECT_FP_EQ(T(-0.0), func(T(-12345.0), &integral));
+    EXPECT_FP_EQ(T(-12345.0), integral);
+  }
+
+  void testFractions(ModfFunc func) {
+    T integral;
+
+    EXPECT_FP_EQ(T(0.5), func(T(1.5), &integral));
+    EXPECT_FP_EQ(integral, T(1.0));
+
+    EXPECT_FP_EQ(T(-0.5), func(T(-1.5), &integral));
+    EXPECT_FP_EQ(integral, T(-1.0));
+
+    EXPECT_FP_EQ(T(0.75), func(T(10.75), &integral));
+    EXPECT_FP_EQ(integral, T(10.0));
+
+    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(integral, T(100.0));
+
+    EXPECT_FP_EQ(T(-0.125), func(T(-100.125), &integral));
+    EXPECT_FP_EQ(integral, T(-100.0));
+  }
+
+  void testRange(ModfFunc func) {
+    constexpr UIntType COUNT = 100'000;
+    constexpr UIntType STEP = UIntType(-1) / COUNT;
+    for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
+      T x = T(FPBits(v));
+      if (isnan(x) || isinf(x) || x == T(0.0))
+        continue;
+
+      T integral;
+      T frac = func(x, &integral);
+      ASSERT_TRUE(__llvm_libc::fputil::abs(frac) < 1.0l);
+      ASSERT_TRUE(__llvm_libc::fputil::trunc(x) == integral);
+      ASSERT_TRUE(integral + frac == x);
+    }
+  }
+};
+
+#define LIST_MODF_TESTS(T, func)                                               \
+  using LlvmLibcModfTest = ModfTest<T>;                                        \
+  TEST_F(LlvmLibcModfTest, SpecialNumbers) { testSpecialNumbers(&func); }      \
+  TEST_F(LlvmLibcModfTest, RoundedNubmers) { testIntegers(&func); }            \
+  TEST_F(LlvmLibcModfTest, Fractions) { testFractions(&func); }                \
+  TEST_F(LlvmLibcModfTest, Range) { testRange(&func); }

diff  --git a/libc/test/src/math/smoke/NextAfterTest.h b/libc/test/src/math/smoke/NextAfterTest.h
new file mode 100644
index 000000000000000..e6de9419d990401
--- /dev/null
+++ b/libc/test/src/math/smoke/NextAfterTest.h
@@ -0,0 +1,198 @@
+//===-- Utility class to test 
diff erent flavors of nextafter ----*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/CPP/type_traits.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+template <typename T>
+class NextAfterTestTemplate : public __llvm_libc::testing::Test {
+  using FPBits = __llvm_libc::fputil::FPBits<T>;
+  using MantissaWidth = __llvm_libc::fputil::MantissaWidth<T>;
+  using UIntType = typename FPBits::UIntType;
+
+  static constexpr int BIT_WIDTH_OF_TYPE =
+      __llvm_libc::fputil::FloatProperties<T>::BIT_WIDTH;
+
+  const T zero = T(FPBits::zero());
+  const T neg_zero = T(FPBits::neg_zero());
+  const T inf = T(FPBits::inf());
+  const T neg_inf = T(FPBits::neg_inf());
+  const T nan = T(FPBits::build_quiet_nan(1));
+  const UIntType min_subnormal = FPBits::MIN_SUBNORMAL;
+  const UIntType max_subnormal = FPBits::MAX_SUBNORMAL;
+  const UIntType min_normal = FPBits::MIN_NORMAL;
+  const UIntType max_normal = FPBits::MAX_NORMAL;
+
+public:
+  typedef T (*NextAfterFunc)(T, T);
+
+  void testNaN(NextAfterFunc func) {
+    ASSERT_FP_EQ(func(nan, 0), nan);
+    ASSERT_FP_EQ(func(0, nan), nan);
+  }
+
+  void testBoundaries(NextAfterFunc func) {
+    ASSERT_FP_EQ(func(zero, neg_zero), neg_zero);
+    ASSERT_FP_EQ(func(neg_zero, zero), zero);
+
+    // 'from' is zero|neg_zero.
+    T x = zero;
+    T result = func(x, T(1));
+    UIntType expected_bits = 1;
+    T expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    result = func(x, T(-1));
+    expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    x = neg_zero;
+    result = func(x, 1);
+    expected_bits = 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    result = func(x, -1);
+    expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    // 'from' is max subnormal value.
+    x = __llvm_libc::cpp::bit_cast<T>(max_subnormal);
+    result = func(x, 1);
+    expected = __llvm_libc::cpp::bit_cast<T>(min_normal);
+    ASSERT_FP_EQ(result, expected);
+
+    result = func(x, 0);
+    expected_bits = max_subnormal - 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    x = -x;
+
+    result = func(x, -1);
+    expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    result = func(x, 0);
+    expected_bits =
+        (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal - 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    // 'from' is min subnormal value.
+    x = __llvm_libc::cpp::bit_cast<T>(min_subnormal);
+    result = func(x, 1);
+    expected_bits = min_subnormal + 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+    ASSERT_FP_EQ(func(x, 0), 0);
+
+    x = -x;
+    result = func(x, -1);
+    expected_bits =
+        (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_subnormal + 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+    ASSERT_FP_EQ(func(x, 0), T(-0.0));
+
+    // 'from' is min normal.
+    x = __llvm_libc::cpp::bit_cast<T>(min_normal);
+    result = func(x, 0);
+    expected_bits = max_subnormal;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    result = func(x, inf);
+    expected_bits = min_normal + 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    x = -x;
+    result = func(x, 0);
+    expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    result = func(x, -inf);
+    expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal + 1;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+
+    // 'from' is max normal and 'to' is infinity.
+    x = __llvm_libc::cpp::bit_cast<T>(max_normal);
+    result = func(x, inf);
+    ASSERT_FP_EQ(result, inf);
+
+    result = func(-x, -inf);
+    ASSERT_FP_EQ(result, -inf);
+
+    // 'from' is infinity.
+    x = inf;
+    result = func(x, 0);
+    expected_bits = max_normal;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+    ASSERT_FP_EQ(func(x, inf), inf);
+
+    x = neg_inf;
+    result = func(x, 0);
+    expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_normal;
+    expected = __llvm_libc::cpp::bit_cast<T>(expected_bits);
+    ASSERT_FP_EQ(result, expected);
+    ASSERT_FP_EQ(func(x, neg_inf), neg_inf);
+
+    // 'from' is a power of 2.
+    x = T(32.0);
+    result = func(x, 0);
+    FPBits x_bits = FPBits(x);
+    FPBits result_bits = FPBits(result);
+    ASSERT_EQ(result_bits.get_unbiased_exponent(),
+              uint16_t(x_bits.get_unbiased_exponent() - 1));
+    ASSERT_EQ(result_bits.get_mantissa(),
+              (UIntType(1) << MantissaWidth::VALUE) - 1);
+
+    result = func(x, T(33.0));
+    result_bits = FPBits(result);
+    ASSERT_EQ(result_bits.get_unbiased_exponent(),
+              x_bits.get_unbiased_exponent());
+    ASSERT_EQ(result_bits.get_mantissa(), x_bits.get_mantissa() + UIntType(1));
+
+    x = -x;
+
+    result = func(x, 0);
+    result_bits = FPBits(result);
+    ASSERT_EQ(result_bits.get_unbiased_exponent(),
+              uint16_t(x_bits.get_unbiased_exponent() - 1));
+    ASSERT_EQ(result_bits.get_mantissa(),
+              (UIntType(1) << MantissaWidth::VALUE) - 1);
+
+    result = func(x, T(-33.0));
+    result_bits = FPBits(result);
+    ASSERT_EQ(result_bits.get_unbiased_exponent(),
+              x_bits.get_unbiased_exponent());
+    ASSERT_EQ(result_bits.get_mantissa(), x_bits.get_mantissa() + UIntType(1));
+  }
+};
+
+#define LIST_NEXTAFTER_TESTS(T, func)                                          \
+  using LlvmLibcNextAfterTest = NextAfterTestTemplate<T>;                      \
+  TEST_F(LlvmLibcNextAfterTest, TestNaN) { testNaN(&func); }                   \
+  TEST_F(LlvmLibcNextAfterTest, TestBoundaries) { testBoundaries(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H

diff  --git a/libc/test/src/math/smoke/RIntTest.h b/libc/test/src/math/smoke/RIntTest.h
new file mode 100644
index 000000000000000..7a6d5c7ed78c96f
--- /dev/null
+++ b/libc/test/src/math/smoke/RIntTest.h
@@ -0,0 +1,56 @@
+//===-- Utility class to test 
diff erent flavors of rint ---------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_RINTTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_RINTTEST_H
+
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <fenv.h>
+#include <math.h>
+#include <stdio.h>
+
+static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
+                                          FE_TONEAREST};
+
+template <typename T>
+class RIntTestTemplate : public __llvm_libc::testing::Test {
+public:
+  typedef T (*RIntFunc)(T);
+
+private:
+  using FPBits = __llvm_libc::fputil::FPBits<T>;
+  using UIntType = typename FPBits::UIntType;
+
+  const T zero = T(FPBits::zero());
+  const T neg_zero = T(FPBits::neg_zero());
+  const T inf = T(FPBits::inf());
+  const T neg_inf = T(FPBits::neg_inf());
+  const T nan = T(FPBits::build_quiet_nan(1));
+
+public:
+  void testSpecialNumbers(RIntFunc func) {
+    for (int mode : ROUNDING_MODES) {
+      __llvm_libc::fputil::set_round(mode);
+      ASSERT_FP_EQ(inf, func(inf));
+      ASSERT_FP_EQ(neg_inf, func(neg_inf));
+      ASSERT_FP_EQ(nan, func(nan));
+      ASSERT_FP_EQ(zero, func(zero));
+      ASSERT_FP_EQ(neg_zero, func(neg_zero));
+    }
+  }
+};
+
+#define LIST_RINT_TESTS(F, func)                                               \
+  using LlvmLibcRIntTest = RIntTestTemplate<F>;                                \
+  TEST_F(LlvmLibcRIntTest, specialNumbers) { testSpecialNumbers(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_RINTTEST_H

diff  --git a/libc/test/src/math/smoke/RemQuoTest.h b/libc/test/src/math/smoke/RemQuoTest.h
new file mode 100644
index 000000000000000..4d49fd7dedc402e
--- /dev/null
+++ b/libc/test/src/math/smoke/RemQuoTest.h
@@ -0,0 +1,102 @@
+//===-- Utility class to test 
diff erent flavors of remquo -------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_REMQUOTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_REMQUOTEST_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+template <typename T>
+class RemQuoTestTemplate : public __llvm_libc::testing::Test {
+  using FPBits = __llvm_libc::fputil::FPBits<T>;
+  using UIntType = typename FPBits::UIntType;
+
+  const T zero = T(__llvm_libc::fputil::FPBits<T>::zero());
+  const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero());
+  const T inf = T(__llvm_libc::fputil::FPBits<T>::inf());
+  const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf());
+  const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1));
+
+public:
+  typedef T (*RemQuoFunc)(T, T, int *);
+
+  void testSpecialNumbers(RemQuoFunc func) {
+    int quotient;
+    T x, y;
+
+    y = T(1.0);
+    x = inf;
+    EXPECT_FP_EQ(nan, func(x, y, &quotient));
+    x = neg_inf;
+    EXPECT_FP_EQ(nan, func(x, y, &quotient));
+
+    x = T(1.0);
+    y = zero;
+    EXPECT_FP_EQ(nan, func(x, y, &quotient));
+    y = neg_zero;
+    EXPECT_FP_EQ(nan, func(x, y, &quotient));
+
+    y = nan;
+    x = T(1.0);
+    EXPECT_FP_EQ(nan, func(x, y, &quotient));
+
+    y = T(1.0);
+    x = nan;
+    EXPECT_FP_EQ(nan, func(x, y, &quotient));
+
+    x = nan;
+    y = nan;
+    EXPECT_FP_EQ(nan, func(x, y, &quotient));
+
+    x = zero;
+    y = T(1.0);
+    EXPECT_FP_EQ(func(x, y, &quotient), zero);
+
+    x = neg_zero;
+    y = T(1.0);
+    EXPECT_FP_EQ(func(x, y, &quotient), neg_zero);
+
+    x = T(1.125);
+    y = inf;
+    EXPECT_FP_EQ(func(x, y, &quotient), x);
+    EXPECT_EQ(quotient, 0);
+  }
+
+  void testEqualNumeratorAndDenominator(RemQuoFunc func) {
+    T x = T(1.125), y = T(1.125);
+    int q;
+
+    // When the remainder is zero, the standard requires it to
+    // have the same sign as x.
+
+    EXPECT_FP_EQ(func(x, y, &q), zero);
+    EXPECT_EQ(q, 1);
+
+    EXPECT_FP_EQ(func(x, -y, &q), zero);
+    EXPECT_EQ(q, -1);
+
+    EXPECT_FP_EQ(func(-x, y, &q), neg_zero);
+    EXPECT_EQ(q, -1);
+
+    EXPECT_FP_EQ(func(-x, -y, &q), neg_zero);
+    EXPECT_EQ(q, 1);
+  }
+};
+
+#define LIST_REMQUO_TESTS(T, func)                                             \
+  using LlvmLibcRemQuoTest = RemQuoTestTemplate<T>;                            \
+  TEST_F(LlvmLibcRemQuoTest, SpecialNumbers) { testSpecialNumbers(&func); }    \
+  TEST_F(LlvmLibcRemQuoTest, EqualNumeratorAndDenominator) {                   \
+    testEqualNumeratorAndDenominator(&func);                                   \
+  }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_REMQUOTEST_H

diff  --git a/libc/test/src/math/smoke/RoundTest.h b/libc/test/src/math/smoke/RoundTest.h
new file mode 100644
index 000000000000000..c67f1ce48220a9a
--- /dev/null
+++ b/libc/test/src/math/smoke/RoundTest.h
@@ -0,0 +1,68 @@
+//===-- Utility class to test round[f|l] ------------------------*- C++ -*-===//
+//
+// 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 "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class RoundTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*RoundFunc)(T);
+
+  void testSpecialNumbers(RoundFunc func) {
+    EXPECT_FP_EQ(zero, func(zero));
+    EXPECT_FP_EQ(neg_zero, func(neg_zero));
+
+    EXPECT_FP_EQ(inf, func(inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf));
+
+    EXPECT_FP_EQ(aNaN, func(aNaN));
+  }
+
+  void testRoundedNumbers(RoundFunc func) {
+    EXPECT_FP_EQ(T(1.0), func(T(1.0)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.0)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.0)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.0)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.0)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.0)));
+  }
+
+  void testFractions(RoundFunc func) {
+    EXPECT_FP_EQ(T(1.0), func(T(0.5)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-0.5)));
+    EXPECT_FP_EQ(T(0.0), func(T(0.115)));
+    EXPECT_FP_EQ(T(-0.0), func(T(-0.115)));
+    EXPECT_FP_EQ(T(1.0), func(T(0.715)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-0.715)));
+    EXPECT_FP_EQ(T(1.0), func(T(1.3)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.3)));
+    EXPECT_FP_EQ(T(2.0), func(T(1.5)));
+    EXPECT_FP_EQ(T(-2.0), func(T(-1.5)));
+    EXPECT_FP_EQ(T(2.0), func(T(1.75)));
+    EXPECT_FP_EQ(T(-2.0), func(T(-1.75)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.32)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.32)));
+    EXPECT_FP_EQ(T(11.0), func(T(10.65)));
+    EXPECT_FP_EQ(T(-11.0), func(T(-10.65)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.38)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.38)));
+    EXPECT_FP_EQ(T(1235.0), func(T(1234.96)));
+    EXPECT_FP_EQ(T(-1235.0), func(T(-1234.96)));
+  }
+};
+
+#define LIST_ROUND_TESTS(T, func)                                              \
+  using LlvmLibcRoundTest = RoundTest<T>;                                      \
+  TEST_F(LlvmLibcRoundTest, SpecialNumbers) { testSpecialNumbers(&func); }     \
+  TEST_F(LlvmLibcRoundTest, RoundedNubmers) { testRoundedNumbers(&func); }     \
+  TEST_F(LlvmLibcRoundTest, Fractions) { testFractions(&func); }

diff  --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h
new file mode 100644
index 000000000000000..c37186bff57b3c8
--- /dev/null
+++ b/libc/test/src/math/smoke/RoundToIntegerTest.h
@@ -0,0 +1,168 @@
+//===-- Utility class to test 
diff erent flavors of [l|ll]round --*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_ROUNDTOINTEGERTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_ROUNDTOINTEGERTEST_H
+
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <errno.h>
+#include <math.h>
+
+static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
+                                          FE_TONEAREST};
+
+template <typename F, typename I, bool TestModes = false>
+class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test {
+public:
+  typedef I (*RoundToIntegerFunc)(F);
+
+private:
+  using FPBits = __llvm_libc::fputil::FPBits<F>;
+  using UIntType = typename FPBits::UIntType;
+
+  const F zero = F(__llvm_libc::fputil::FPBits<F>::zero());
+  const F neg_zero = F(__llvm_libc::fputil::FPBits<F>::neg_zero());
+  const F inf = F(__llvm_libc::fputil::FPBits<F>::inf());
+  const F neg_inf = F(__llvm_libc::fputil::FPBits<F>::neg_inf());
+  const F nan = F(__llvm_libc::fputil::FPBits<F>::build_quiet_nan(1));
+  static constexpr I INTEGER_MIN = I(1) << (sizeof(I) * 8 - 1);
+  static constexpr I INTEGER_MAX = -(INTEGER_MIN + 1);
+
+  void test_one_input(RoundToIntegerFunc func, F input, I expected,
+                      bool expectError) {
+    libc_errno = 0;
+    __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+
+    ASSERT_EQ(func(input), expected);
+
+    if (expectError) {
+      ASSERT_FP_EXCEPTION(FE_INVALID);
+      ASSERT_MATH_ERRNO(EDOM);
+    } else {
+      ASSERT_FP_EXCEPTION(0);
+      ASSERT_MATH_ERRNO(0);
+    }
+  }
+
+public:
+  void SetUp() override {
+    if (math_errhandling & MATH_ERREXCEPT) {
+      // We will disable all exceptions so that the test will not
+      // crash with SIGFPE. We can still use fetestexcept to check
+      // if the appropriate flag was raised.
+      __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT);
+    }
+  }
+
+  void do_infinity_and_na_n_test(RoundToIntegerFunc func) {
+    test_one_input(func, inf, INTEGER_MAX, true);
+    test_one_input(func, neg_inf, INTEGER_MIN, true);
+    // This is currently never enabled, the
+    // LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR CMake option in
+    // libc/CMakeLists.txt is not forwarded to C++.
+#if LIBC_COPT_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR
+    // Result is not well-defined, we always returns INTEGER_MAX
+    test_one_input(func, nan, INTEGER_MAX, true);
+#endif // LIBC_COPT_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR
+  }
+
+  void testInfinityAndNaN(RoundToIntegerFunc func) {
+    if (TestModes) {
+      for (int mode : ROUNDING_MODES) {
+        __llvm_libc::fputil::set_round(mode);
+        do_infinity_and_na_n_test(func);
+      }
+    } else {
+      do_infinity_and_na_n_test(func);
+    }
+  }
+
+  void do_round_numbers_test(RoundToIntegerFunc func) {
+    test_one_input(func, zero, I(0), false);
+    test_one_input(func, neg_zero, I(0), false);
+    test_one_input(func, F(1.0), I(1), false);
+    test_one_input(func, F(-1.0), I(-1), false);
+    test_one_input(func, F(10.0), I(10), false);
+    test_one_input(func, F(-10.0), I(-10), false);
+    test_one_input(func, F(1234.0), I(1234), false);
+    test_one_input(func, F(-1234.0), I(-1234), false);
+  }
+
+  void testRoundNumbers(RoundToIntegerFunc func) {
+    if (TestModes) {
+      for (int mode : ROUNDING_MODES) {
+        __llvm_libc::fputil::set_round(mode);
+        do_round_numbers_test(func);
+      }
+    } else {
+      do_round_numbers_test(func);
+    }
+  }
+
+  void testSubnormalRange(RoundToIntegerFunc func) {
+    constexpr UIntType COUNT = 1'000'001;
+    constexpr UIntType STEP =
+        (UIntType(FPBits::MAX_SUBNORMAL) - UIntType(FPBits::MIN_SUBNORMAL)) /
+        COUNT;
+    for (UIntType i = FPBits::MIN_SUBNORMAL; i <= FPBits::MAX_SUBNORMAL;
+         i += STEP) {
+      F x = F(FPBits(i));
+      if (x == F(0.0))
+        continue;
+      // All subnormal numbers should round to zero.
+      if (TestModes) {
+        if (x > 0) {
+          __llvm_libc::fputil::set_round(FE_UPWARD);
+          test_one_input(func, x, I(1), false);
+          __llvm_libc::fputil::set_round(FE_DOWNWARD);
+          test_one_input(func, x, I(0), false);
+          __llvm_libc::fputil::set_round(FE_TOWARDZERO);
+          test_one_input(func, x, I(0), false);
+          __llvm_libc::fputil::set_round(FE_TONEAREST);
+          test_one_input(func, x, I(0), false);
+        } else {
+          __llvm_libc::fputil::set_round(FE_UPWARD);
+          test_one_input(func, x, I(0), false);
+          __llvm_libc::fputil::set_round(FE_DOWNWARD);
+          test_one_input(func, x, I(-1), false);
+          __llvm_libc::fputil::set_round(FE_TOWARDZERO);
+          test_one_input(func, x, I(0), false);
+          __llvm_libc::fputil::set_round(FE_TONEAREST);
+          test_one_input(func, x, I(0), false);
+        }
+      } else {
+        test_one_input(func, x, 0L, false);
+      }
+    }
+  }
+};
+
+#define LIST_ROUND_TO_INTEGER_TESTS_HELPER(F, I, func, TestModes)              \
+  using LlvmLibcRoundToIntegerTest =                                           \
+      RoundToIntegerTestTemplate<F, I, TestModes>;                             \
+  TEST_F(LlvmLibcRoundToIntegerTest, InfinityAndNaN) {                         \
+    testInfinityAndNaN(&func);                                                 \
+  }                                                                            \
+  TEST_F(LlvmLibcRoundToIntegerTest, RoundNumbers) {                           \
+    testRoundNumbers(&func);                                                   \
+  }                                                                            \
+  TEST_F(LlvmLibcRoundToIntegerTest, SubnormalRange) {                         \
+    testSubnormalRange(&func);                                                 \
+  }
+
+#define LIST_ROUND_TO_INTEGER_TESTS(F, I, func)                                \
+  LIST_ROUND_TO_INTEGER_TESTS_HELPER(F, I, func, false)
+
+#define LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(F, I, func)                     \
+  LIST_ROUND_TO_INTEGER_TESTS_HELPER(F, I, func, true)
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_ROUNDTOINTEGERTEST_H

diff  --git a/libc/test/src/math/smoke/ScalbnTest.h b/libc/test/src/math/smoke/ScalbnTest.h
new file mode 100644
index 000000000000000..e1d035c4ea3aa09
--- /dev/null
+++ b/libc/test/src/math/smoke/ScalbnTest.h
@@ -0,0 +1,28 @@
+//===-- Utility class to test 
diff erent flavors of scalbn -------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_SCALBN_H
+#define LLVM_LIBC_TEST_SRC_MATH_SCALBN_H
+
+#include "LdExpTest.h"
+#include "test/UnitTest/Test.h"
+
+#define LIST_SCALBN_TESTS(T, func)                                             \
+  using LlvmLibcScalbnTest = LdExpTestTemplate<T>;                             \
+  TEST_F(LlvmLibcScalbnTest, SpecialNumbers) { testSpecialNumbers(&func); }    \
+  TEST_F(LlvmLibcScalbnTest, PowersOfTwo) { testPowersOfTwo(&func); }          \
+  TEST_F(LlvmLibcScalbnTest, OverFlow) { testOverflow(&func); }                \
+  TEST_F(LlvmLibcScalbnTest, UnderflowToZeroOnNormal) {                        \
+    testUnderflowToZeroOnNormal(&func);                                        \
+  }                                                                            \
+  TEST_F(LlvmLibcScalbnTest, UnderflowToZeroOnSubnormal) {                     \
+    testUnderflowToZeroOnSubnormal(&func);                                     \
+  }                                                                            \
+  TEST_F(LlvmLibcScalbnTest, NormalOperation) { testNormalOperation(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SCALBN_H

diff  --git a/libc/test/src/math/smoke/SqrtTest.h b/libc/test/src/math/smoke/SqrtTest.h
new file mode 100644
index 000000000000000..c3896e302373a26
--- /dev/null
+++ b/libc/test/src/math/smoke/SqrtTest.h
@@ -0,0 +1,40 @@
+//===-- Utility class to test sqrt[f|l] -------------------------*- C++ -*-===//
+//
+// 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/__support/CPP/bit.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class SqrtTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+  static constexpr UIntType HIDDEN_BIT =
+      UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE;
+
+public:
+  typedef T (*SqrtFunc)(T);
+
+  void test_special_numbers(SqrtFunc func) {
+    ASSERT_FP_EQ(aNaN, func(aNaN));
+    ASSERT_FP_EQ(inf, func(inf));
+    ASSERT_FP_EQ(aNaN, func(neg_inf));
+    ASSERT_FP_EQ(0.0, func(0.0));
+    ASSERT_FP_EQ(-0.0, func(-0.0));
+    ASSERT_FP_EQ(aNaN, func(T(-1.0)));
+    ASSERT_FP_EQ(T(1.0), func(T(1.0)));
+    ASSERT_FP_EQ(T(2.0), func(T(4.0)));
+    ASSERT_FP_EQ(T(3.0), func(T(9.0)));
+  }
+};
+
+#define LIST_SQRT_TESTS(T, func)                                               \
+  using LlvmLibcSqrtTest = SqrtTest<T>;                                        \
+  TEST_F(LlvmLibcSqrtTest, SpecialNumbers) { test_special_numbers(&func); }

diff  --git a/libc/test/src/math/smoke/TruncTest.h b/libc/test/src/math/smoke/TruncTest.h
new file mode 100644
index 000000000000000..32b5503589ca7a0
--- /dev/null
+++ b/libc/test/src/math/smoke/TruncTest.h
@@ -0,0 +1,68 @@
+//===-- Utility class to test trunc[f|l] ------------------------*- C++ -*-===//
+//
+// 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 "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T> class TruncTest : public __llvm_libc::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*TruncFunc)(T);
+
+  void testSpecialNumbers(TruncFunc func) {
+    EXPECT_FP_EQ(zero, func(zero));
+    EXPECT_FP_EQ(neg_zero, func(neg_zero));
+
+    EXPECT_FP_EQ(inf, func(inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf));
+
+    EXPECT_FP_EQ(aNaN, func(aNaN));
+  }
+
+  void testRoundedNumbers(TruncFunc func) {
+    EXPECT_FP_EQ(T(1.0), func(T(1.0)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.0)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.0)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.0)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.0)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.0)));
+  }
+
+  void testFractions(TruncFunc func) {
+    EXPECT_FP_EQ(T(0.0), func(T(0.5)));
+    EXPECT_FP_EQ(T(-0.0), func(T(-0.5)));
+    EXPECT_FP_EQ(T(0.0), func(T(0.115)));
+    EXPECT_FP_EQ(T(-0.0), func(T(-0.115)));
+    EXPECT_FP_EQ(T(0.0), func(T(0.715)));
+    EXPECT_FP_EQ(T(-0.0), func(T(-0.715)));
+    EXPECT_FP_EQ(T(1.0), func(T(1.3)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.3)));
+    EXPECT_FP_EQ(T(1.0), func(T(1.5)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.5)));
+    EXPECT_FP_EQ(T(1.0), func(T(1.75)));
+    EXPECT_FP_EQ(T(-1.0), func(T(-1.75)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.32)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.32)));
+    EXPECT_FP_EQ(T(10.0), func(T(10.65)));
+    EXPECT_FP_EQ(T(-10.0), func(T(-10.65)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.38)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.38)));
+    EXPECT_FP_EQ(T(1234.0), func(T(1234.96)));
+    EXPECT_FP_EQ(T(-1234.0), func(T(-1234.96)));
+  }
+};
+
+#define LIST_TRUNC_TESTS(T, func)                                              \
+  using LlvmLibcTruncTest = TruncTest<T>;                                      \
+  TEST_F(LlvmLibcTruncTest, SpecialNumbers) { testSpecialNumbers(&func); }     \
+  TEST_F(LlvmLibcTruncTest, RoundedNubmers) { testRoundedNumbers(&func); }     \
+  TEST_F(LlvmLibcTruncTest, Fractions) { testFractions(&func); }

diff  --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp
new file mode 100644
index 000000000000000..0fc20970232f7bc
--- /dev/null
+++ b/libc/test/src/math/smoke/acosf_test.cpp
@@ -0,0 +1,43 @@
+//===-- Unittests for acosf -----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/acosf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcAcosfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(inf));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(neg_inf));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::acosf(1.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(2.0f));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(-2.0f));
+  EXPECT_MATH_ERRNO(EDOM);
+}

diff  --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp
new file mode 100644
index 000000000000000..ac3021ff3154e41
--- /dev/null
+++ b/libc/test/src/math/smoke/acoshf_test.cpp
@@ -0,0 +1,40 @@
+//===-- Unittests for acoshf ----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/acoshf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits_t = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcAcoshfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(0.0f));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::acoshf(1.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::acoshf(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(neg_inf));
+  EXPECT_MATH_ERRNO(EDOM);
+}

diff  --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp
new file mode 100644
index 000000000000000..f6455475947a3e2
--- /dev/null
+++ b/libc/test/src/math/smoke/asinf_test.cpp
@@ -0,0 +1,46 @@
+//===-- Unittests for asinf -----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/asinf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcAsinfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(inf));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(neg_inf));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(2.0f));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(-2.0f));
+  EXPECT_MATH_ERRNO(EDOM);
+}

diff  --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp
new file mode 100644
index 000000000000000..6b5f9437b4149a7
--- /dev/null
+++ b/libc/test/src/math/smoke/asinhf_test.cpp
@@ -0,0 +1,40 @@
+//===-- Unittests for asinhf ----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/asinhf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits_t = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcAsinhfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinhf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinhf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinhf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::asinhf(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::asinhf(neg_inf));
+  EXPECT_MATH_ERRNO(0);
+}

diff  --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp
new file mode 100644
index 000000000000000..7d3f38682e8c01c
--- /dev/null
+++ b/libc/test/src/math/smoke/atanf_test.cpp
@@ -0,0 +1,40 @@
+//===-- Unittests for atanf -----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/atanf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcAtanfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanf(aNaN));
+  EXPECT_FP_EXCEPTION(0);
+  EXPECT_MATH_ERRNO(0);
+
+  __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanf(0.0f));
+  EXPECT_FP_EXCEPTION(0);
+  EXPECT_MATH_ERRNO(0);
+
+  __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+  EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanf(-0.0f));
+  EXPECT_FP_EXCEPTION(0);
+  EXPECT_MATH_ERRNO(0);
+}

diff  --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp
new file mode 100644
index 000000000000000..ac2d47babe4eb0d
--- /dev/null
+++ b/libc/test/src/math/smoke/atanhf_test.cpp
@@ -0,0 +1,72 @@
+//===-- Unittests for atanhf ----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/atanhf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcAtanhfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(aNaN));
+  EXPECT_FP_EXCEPTION(0);
+  EXPECT_MATH_ERRNO(0);
+
+  __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanhf(0.0f));
+  EXPECT_FP_EXCEPTION(0);
+  EXPECT_MATH_ERRNO(0);
+
+  __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT);
+  EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanhf(-0.0f));
+  EXPECT_FP_EXCEPTION(0);
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::atanhf(1.0f), FE_DIVBYZERO);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::atanhf(-1.0f),
+                              FE_DIVBYZERO);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  auto bt = FPBits(1.0f);
+  bt.bits += 1;
+
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(bt.get_val()),
+                                  FE_INVALID);
+  EXPECT_MATH_ERRNO(EDOM);
+
+  bt.set_sign(true);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(bt.get_val()),
+                                  FE_INVALID);
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(2.0f), FE_INVALID);
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(-2.0f), FE_INVALID);
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(inf), FE_INVALID);
+  EXPECT_MATH_ERRNO(EDOM);
+
+  bt.set_sign(true);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(neg_inf), FE_INVALID);
+  EXPECT_MATH_ERRNO(EDOM);
+}

diff  --git a/libc/test/src/math/smoke/ceil_test.cpp b/libc/test/src/math/smoke/ceil_test.cpp
new file mode 100644
index 000000000000000..2a592e3ee85b0cc
--- /dev/null
+++ b/libc/test/src/math/smoke/ceil_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ceil ------------------------------------------------===//
+//
+// 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 "CeilTest.h"
+
+#include "src/math/ceil.h"
+
+LIST_CEIL_TESTS(double, __llvm_libc::ceil)

diff  --git a/libc/test/src/math/smoke/ceilf_test.cpp b/libc/test/src/math/smoke/ceilf_test.cpp
new file mode 100644
index 000000000000000..cfa8cb2c5aa6dd4
--- /dev/null
+++ b/libc/test/src/math/smoke/ceilf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ceilf -----------------------------------------------===//
+//
+// 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 "CeilTest.h"
+
+#include "src/math/ceilf.h"
+
+LIST_CEIL_TESTS(float, __llvm_libc::ceilf)

diff  --git a/libc/test/src/math/smoke/ceill_test.cpp b/libc/test/src/math/smoke/ceill_test.cpp
new file mode 100644
index 000000000000000..6fe30465edc8574
--- /dev/null
+++ b/libc/test/src/math/smoke/ceill_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ceill -----------------------------------------------===//
+//
+// 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 "CeilTest.h"
+
+#include "src/math/ceill.h"
+
+LIST_CEIL_TESTS(long double, __llvm_libc::ceill)

diff  --git a/libc/test/src/math/smoke/copysign_test.cpp b/libc/test/src/math/smoke/copysign_test.cpp
new file mode 100644
index 000000000000000..37bfa0d90c37896
--- /dev/null
+++ b/libc/test/src/math/smoke/copysign_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for copysign --------------------------------------------===//
+//
+// 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/math/copysign.h"
+
+LIST_COPYSIGN_TESTS(double, __llvm_libc::copysign)

diff  --git a/libc/test/src/math/smoke/copysignf_test.cpp b/libc/test/src/math/smoke/copysignf_test.cpp
new file mode 100644
index 000000000000000..fec283ccd0c7acd
--- /dev/null
+++ b/libc/test/src/math/smoke/copysignf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for copysignf -------------------------------------------===//
+//
+// 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/math/copysignf.h"
+
+LIST_COPYSIGN_TESTS(float, __llvm_libc::copysignf)

diff  --git a/libc/test/src/math/smoke/copysignl_test.cpp b/libc/test/src/math/smoke/copysignl_test.cpp
new file mode 100644
index 000000000000000..d1de911196b62b7
--- /dev/null
+++ b/libc/test/src/math/smoke/copysignl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for copysignl -------------------------------------------===//
+//
+// 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/math/copysignl.h"
+
+LIST_COPYSIGN_TESTS(long double, __llvm_libc::copysignl)

diff  --git a/libc/test/src/math/smoke/cosf_test.cpp b/libc/test/src/math/smoke/cosf_test.cpp
new file mode 100644
index 000000000000000..4ef96677eb4d1ca
--- /dev/null
+++ b/libc/test/src/math/smoke/cosf_test.cpp
@@ -0,0 +1,40 @@
+//===-- Unittests for cosf ------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/cosf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcCosfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::cosf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::cosf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(inf));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(neg_inf));
+  EXPECT_MATH_ERRNO(EDOM);
+}

diff  --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp
new file mode 100644
index 000000000000000..7198aa266aa8d3b
--- /dev/null
+++ b/libc/test/src/math/smoke/coshf_test.cpp
@@ -0,0 +1,56 @@
+//===-- Unittests for coshf -----------------------------------------------===//
+//
+// 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/__support/CPP/array.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/coshf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcCoshfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::coshf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::coshf(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::coshf(neg_inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::coshf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::coshf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+}
+
+TEST(LlvmLibcCoshfTest, Overflow) {
+  libc_errno = 0;
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+}

diff  --git a/libc/test/src/math/smoke/erff_test.cpp b/libc/test/src/math/smoke/erff_test.cpp
new file mode 100644
index 000000000000000..c2a247b6e6672ff
--- /dev/null
+++ b/libc/test/src/math/smoke/erff_test.cpp
@@ -0,0 +1,28 @@
+//===-- Unittests for erff ------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/math/erff.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcErffTest, SpecialNumbers) {
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::erff(aNaN));
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::erff(inf));
+  EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::erff(neg_inf));
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::erff(zero));
+  EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, __llvm_libc::erff(neg_zero));
+}

diff  --git a/libc/test/src/math/smoke/exp10_test.cpp b/libc/test/src/math/smoke/exp10_test.cpp
new file mode 100644
index 000000000000000..21ba51d32345a78
--- /dev/null
+++ b/libc/test/src/math/smoke/exp10_test.cpp
@@ -0,0 +1,36 @@
+//===-- Unittests for 10^x ------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/exp10.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(double)
+
+TEST(LlvmLibcExp10Test, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::exp10(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::exp10(inf));
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp10(neg_inf));
+  EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp10(-0x1.0p20),
+                              FE_UNDERFLOW);
+  EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp10(0x1.0p20), FE_OVERFLOW);
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(0.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(-0.0));
+
+  EXPECT_FP_EQ_ALL_ROUNDING(10.0, __llvm_libc::exp10(1.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(100.0, __llvm_libc::exp10(2.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(1000.0, __llvm_libc::exp10(3.0));
+}

diff  --git a/libc/test/src/math/smoke/exp10f_test.cpp b/libc/test/src/math/smoke/exp10f_test.cpp
new file mode 100644
index 000000000000000..4de0074ab826929
--- /dev/null
+++ b/libc/test/src/math/smoke/exp10f_test.cpp
@@ -0,0 +1,56 @@
+//===-- Unittests for exp10f ----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/exp10f.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <stdint.h>
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcExp10fTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::exp10f(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::exp10f(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::exp10f(neg_inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::exp10f(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::exp10f(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(10.0f, __llvm_libc::exp10f(1.0f));
+  EXPECT_FP_EQ_ALL_ROUNDING(100.0f, __llvm_libc::exp10f(2.0f));
+  EXPECT_FP_EQ_ALL_ROUNDING(1000.0f, __llvm_libc::exp10f(3.0f));
+}
+
+TEST(LlvmLibcExp10fTest, Overflow) {
+  libc_errno = 0;
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+}

diff  --git a/libc/test/src/math/smoke/exp2_test.cpp b/libc/test/src/math/smoke/exp2_test.cpp
new file mode 100644
index 000000000000000..13b24b01261096a
--- /dev/null
+++ b/libc/test/src/math/smoke/exp2_test.cpp
@@ -0,0 +1,35 @@
+//===-- Unittests for 2^x -------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/exp2.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(double)
+
+TEST(LlvmLibcExp2Test, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::exp2(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::exp2(inf));
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp2(neg_inf));
+  EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp2(-0x1.0p20), FE_UNDERFLOW);
+  EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp2(0x1.0p20), FE_OVERFLOW);
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(0.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(-0.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(2.0, __llvm_libc::exp2(1.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(0.5, __llvm_libc::exp2(-1.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(4.0, __llvm_libc::exp2(2.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(0.25, __llvm_libc::exp2(-2.0));
+}

diff  --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp
new file mode 100644
index 000000000000000..c22a5eb294100b4
--- /dev/null
+++ b/libc/test/src/math/smoke/exp2f_test.cpp
@@ -0,0 +1,58 @@
+//===-- Unittests for exp2f -----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
+#include "src/errno/libc_errno.h"
+#include "src/math/exp2f.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <stdint.h>
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcExp2fTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::exp2f(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::exp2f(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::exp2f(neg_inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::exp2f(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::exp2f(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(2.0f, __llvm_libc::exp2f(1.0f));
+  EXPECT_FP_EQ_ALL_ROUNDING(0.5f, __llvm_libc::exp2f(-1.0f));
+  EXPECT_FP_EQ_ALL_ROUNDING(4.0f, __llvm_libc::exp2f(2.0f));
+  EXPECT_FP_EQ_ALL_ROUNDING(0.25f, __llvm_libc::exp2f(-2.0f));
+}
+
+TEST(LlvmLibcExp2fTest, Overflow) {
+  libc_errno = 0;
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+}

diff  --git a/libc/test/src/math/smoke/exp_test.cpp b/libc/test/src/math/smoke/exp_test.cpp
new file mode 100644
index 000000000000000..3406f0afd73ebe0
--- /dev/null
+++ b/libc/test/src/math/smoke/exp_test.cpp
@@ -0,0 +1,31 @@
+//===-- Unittests for exp -------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/exp.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(double)
+
+TEST(LlvmLibcExpTest, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::exp(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::exp(inf));
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp(neg_inf));
+  EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp(-0x1.0p20), FE_UNDERFLOW);
+  EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp(0x1.0p20), FE_OVERFLOW);
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(0.0));
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(-0.0));
+}

diff  --git a/libc/test/src/math/smoke/expf_test.cpp b/libc/test/src/math/smoke/expf_test.cpp
new file mode 100644
index 000000000000000..174d58013cc0647
--- /dev/null
+++ b/libc/test/src/math/smoke/expf_test.cpp
@@ -0,0 +1,52 @@
+//===-- Unittests for expf ------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/expf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <stdint.h>
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcExpfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::expf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::expf(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::expf(neg_inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::expf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::expf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+}
+
+TEST(LlvmLibcExpfTest, Overflow) {
+  libc_errno = 0;
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+}

diff  --git a/libc/test/src/math/smoke/expm1f_test.cpp b/libc/test/src/math/smoke/expm1f_test.cpp
new file mode 100644
index 000000000000000..f34562434eb3480
--- /dev/null
+++ b/libc/test/src/math/smoke/expm1f_test.cpp
@@ -0,0 +1,52 @@
+//===-- Unittests for expm1f-----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/expm1f.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <stdint.h>
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcExpm1fTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::expm1f(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::expm1f(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::expm1f(neg_inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::expm1f(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::expm1f(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+}
+
+TEST(LlvmLibcExpm1fTest, Overflow) {
+  libc_errno = 0;
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+}

diff  --git a/libc/test/src/math/smoke/fabs_test.cpp b/libc/test/src/math/smoke/fabs_test.cpp
new file mode 100644
index 000000000000000..2bf0ddda44ade35
--- /dev/null
+++ b/libc/test/src/math/smoke/fabs_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fabs ------------------------------------------------===//
+//
+// 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 "FAbsTest.h"
+
+#include "src/math/fabs.h"
+
+LIST_FABS_TESTS(double, __llvm_libc::fabs)

diff  --git a/libc/test/src/math/smoke/fabsf_test.cpp b/libc/test/src/math/smoke/fabsf_test.cpp
new file mode 100644
index 000000000000000..6374a1018f1da42
--- /dev/null
+++ b/libc/test/src/math/smoke/fabsf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fabsf -----------------------------------------------===//
+//
+// 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 "FAbsTest.h"
+
+#include "src/math/fabsf.h"
+
+LIST_FABS_TESTS(float, __llvm_libc::fabsf)

diff  --git a/libc/test/src/math/smoke/fabsl_test.cpp b/libc/test/src/math/smoke/fabsl_test.cpp
new file mode 100644
index 000000000000000..ff1320225452a92
--- /dev/null
+++ b/libc/test/src/math/smoke/fabsl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fabsl -----------------------------------------------===//
+//
+// 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 "FAbsTest.h"
+
+#include "src/math/fabsl.h"
+
+LIST_FABS_TESTS(long double, __llvm_libc::fabsl)

diff  --git a/libc/test/src/math/smoke/fdim_test.cpp b/libc/test/src/math/smoke/fdim_test.cpp
new file mode 100644
index 000000000000000..80174b79b95b83c
--- /dev/null
+++ b/libc/test/src/math/smoke/fdim_test.cpp
@@ -0,0 +1,31 @@
+//===-- Unittests for fdim ------------------------------------------------===//
+//
+// 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/FPBits.h"
+#include "src/math/fdim.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+using LlvmLibcFDimTest = FDimTestTemplate<double>;
+
+TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&__llvm_libc::fdim); }
+
+TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&__llvm_libc::fdim); }
+
+TEST_F(LlvmLibcFDimTest, NegInfArg_fdim) {
+  test_neg_inf_arg(&__llvm_libc::fdim);
+}
+
+TEST_F(LlvmLibcFDimTest, BothZero_fdim) { test_both_zero(&__llvm_libc::fdim); }
+
+TEST_F(LlvmLibcFDimTest, InDoubleRange_fdim) {
+  test_in_range(&__llvm_libc::fdim);
+}

diff  --git a/libc/test/src/math/smoke/fdimf_test.cpp b/libc/test/src/math/smoke/fdimf_test.cpp
new file mode 100644
index 000000000000000..531b89b81ffc9ed
--- /dev/null
+++ b/libc/test/src/math/smoke/fdimf_test.cpp
@@ -0,0 +1,33 @@
+//===-- Unittests for fdimf -----------------------------------------------===//
+//
+// 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/FPBits.h"
+#include "src/math/fdimf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+using LlvmLibcFDimTest = FDimTestTemplate<float>;
+
+TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { test_na_n_arg(&__llvm_libc::fdimf); }
+
+TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&__llvm_libc::fdimf); }
+
+TEST_F(LlvmLibcFDimTest, NegInfArg_fdimf) {
+  test_neg_inf_arg(&__llvm_libc::fdimf);
+}
+
+TEST_F(LlvmLibcFDimTest, BothZero_fdimf) {
+  test_both_zero(&__llvm_libc::fdimf);
+}
+
+TEST_F(LlvmLibcFDimTest, InFloatRange_fdimf) {
+  test_in_range(&__llvm_libc::fdimf);
+}

diff  --git a/libc/test/src/math/smoke/fdiml_test.cpp b/libc/test/src/math/smoke/fdiml_test.cpp
new file mode 100644
index 000000000000000..bb6c54d567a0b28
--- /dev/null
+++ b/libc/test/src/math/smoke/fdiml_test.cpp
@@ -0,0 +1,33 @@
+//===-- Unittests for fdiml -----------------------------------------------===//
+//
+// 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/FPBits.h"
+#include "src/math/fdiml.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+using LlvmLibcFDimTest = FDimTestTemplate<long double>;
+
+TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { test_na_n_arg(&__llvm_libc::fdiml); }
+
+TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&__llvm_libc::fdiml); }
+
+TEST_F(LlvmLibcFDimTest, NegInfArg_fdiml) {
+  test_neg_inf_arg(&__llvm_libc::fdiml);
+}
+
+TEST_F(LlvmLibcFDimTest, BothZero_fdiml) {
+  test_both_zero(&__llvm_libc::fdiml);
+}
+
+TEST_F(LlvmLibcFDimTest, InLongDoubleRange_fdiml) {
+  test_in_range(&__llvm_libc::fdiml);
+}

diff  --git a/libc/test/src/math/smoke/floor_test.cpp b/libc/test/src/math/smoke/floor_test.cpp
new file mode 100644
index 000000000000000..e68ed3ecbb603e0
--- /dev/null
+++ b/libc/test/src/math/smoke/floor_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for floor -----------------------------------------------===//
+//
+// 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 "FloorTest.h"
+
+#include "src/math/floor.h"
+
+LIST_FLOOR_TESTS(double, __llvm_libc::floor)

diff  --git a/libc/test/src/math/smoke/floorf_test.cpp b/libc/test/src/math/smoke/floorf_test.cpp
new file mode 100644
index 000000000000000..f0538f7b97b22f4
--- /dev/null
+++ b/libc/test/src/math/smoke/floorf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for floorf ----------------------------------------------===//
+//
+// 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 "FloorTest.h"
+
+#include "src/math/floorf.h"
+
+LIST_FLOOR_TESTS(float, __llvm_libc::floorf)

diff  --git a/libc/test/src/math/smoke/floorl_test.cpp b/libc/test/src/math/smoke/floorl_test.cpp
new file mode 100644
index 000000000000000..1b244fd62a117be
--- /dev/null
+++ b/libc/test/src/math/smoke/floorl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for floorl ----------------------------------------------===//
+//
+// 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 "FloorTest.h"
+
+#include "src/math/floorl.h"
+
+LIST_FLOOR_TESTS(long double, __llvm_libc::floorl)

diff  --git a/libc/test/src/math/smoke/fma_test.cpp b/libc/test/src/math/smoke/fma_test.cpp
new file mode 100644
index 000000000000000..f33860f65236bde
--- /dev/null
+++ b/libc/test/src/math/smoke/fma_test.cpp
@@ -0,0 +1,17 @@
+//===-- Unittests for fma ------------------------------------------------===//
+//
+// 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 "FmaTest.h"
+
+#include "src/math/fma.h"
+
+using LlvmLibcFmaTest = FmaTestTemplate<double>;
+
+TEST_F(LlvmLibcFmaTest, SpecialNumbers) {
+  test_special_numbers(&__llvm_libc::fma);
+}

diff  --git a/libc/test/src/math/smoke/fmaf_test.cpp b/libc/test/src/math/smoke/fmaf_test.cpp
new file mode 100644
index 000000000000000..38c2ea35db056db
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaf_test.cpp
@@ -0,0 +1,17 @@
+//===-- Unittests for fmaf ------------------------------------------------===//
+//
+// 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 "FmaTest.h"
+
+#include "src/math/fmaf.h"
+
+using LlvmLibcFmafTest = FmaTestTemplate<float>;
+
+TEST_F(LlvmLibcFmafTest, SpecialNumbers) {
+  test_special_numbers(&__llvm_libc::fmaf);
+}

diff  --git a/libc/test/src/math/smoke/fmax_test.cpp b/libc/test/src/math/smoke/fmax_test.cpp
new file mode 100644
index 000000000000000..9c81c09414f0139
--- /dev/null
+++ b/libc/test/src/math/smoke/fmax_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmax -----------------------------------------------===//
+//
+// 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 "FMaxTest.h"
+
+#include "src/math/fmax.h"
+
+LIST_FMAX_TESTS(double, __llvm_libc::fmax)

diff  --git a/libc/test/src/math/smoke/fmaxf_test.cpp b/libc/test/src/math/smoke/fmaxf_test.cpp
new file mode 100644
index 000000000000000..cf337d4f07e0307
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaxf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaxf -----------------------------------------------===//
+//
+// 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 "FMaxTest.h"
+
+#include "src/math/fmaxf.h"
+
+LIST_FMAX_TESTS(float, __llvm_libc::fmaxf)

diff  --git a/libc/test/src/math/smoke/fmaxl_test.cpp b/libc/test/src/math/smoke/fmaxl_test.cpp
new file mode 100644
index 000000000000000..636bc4208caef65
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaxl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaxl -----------------------------------------------===//
+//
+// 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 "FMaxTest.h"
+
+#include "src/math/fmaxl.h"
+
+LIST_FMAX_TESTS(long double, __llvm_libc::fmaxl)

diff  --git a/libc/test/src/math/smoke/fmin_test.cpp b/libc/test/src/math/smoke/fmin_test.cpp
new file mode 100644
index 000000000000000..3515f97faca33cd
--- /dev/null
+++ b/libc/test/src/math/smoke/fmin_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmin -----------------------------------------------===//
+//
+// 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 "FMinTest.h"
+
+#include "src/math/fmin.h"
+
+LIST_FMIN_TESTS(double, __llvm_libc::fmin)

diff  --git a/libc/test/src/math/smoke/fminf_test.cpp b/libc/test/src/math/smoke/fminf_test.cpp
new file mode 100644
index 000000000000000..1a762478af613b1
--- /dev/null
+++ b/libc/test/src/math/smoke/fminf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminf -----------------------------------------------===//
+//
+// 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 "FMinTest.h"
+
+#include "src/math/fminf.h"
+
+LIST_FMIN_TESTS(float, __llvm_libc::fminf)

diff  --git a/libc/test/src/math/smoke/fminl_test.cpp b/libc/test/src/math/smoke/fminl_test.cpp
new file mode 100644
index 000000000000000..ce8b705b0385e2e
--- /dev/null
+++ b/libc/test/src/math/smoke/fminl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminl -----------------------------------------------===//
+//
+// 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 "FMinTest.h"
+
+#include "src/math/fminl.h"
+
+LIST_FMIN_TESTS(long double, __llvm_libc::fminl)

diff  --git a/libc/test/src/math/smoke/fmod_test.cpp b/libc/test/src/math/smoke/fmod_test.cpp
new file mode 100644
index 000000000000000..03790e4941e1918
--- /dev/null
+++ b/libc/test/src/math/smoke/fmod_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmod ------------------------------------------------===//
+//
+// 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/math/fmod.h"
+
+LIST_FMOD_TESTS(double, __llvm_libc::fmod)

diff  --git a/libc/test/src/math/smoke/fmodf_test.cpp b/libc/test/src/math/smoke/fmodf_test.cpp
new file mode 100644
index 000000000000000..2b13379eba25235
--- /dev/null
+++ b/libc/test/src/math/smoke/fmodf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmodf -----------------------------------------------===//
+//
+// 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/math/fmodf.h"
+
+LIST_FMOD_TESTS(float, __llvm_libc::fmodf)

diff  --git a/libc/test/src/math/smoke/frexp_test.cpp b/libc/test/src/math/smoke/frexp_test.cpp
new file mode 100644
index 000000000000000..a44aefc7d8b4e33
--- /dev/null
+++ b/libc/test/src/math/smoke/frexp_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for frexp -----------------------------------------------===//
+//
+// 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/math/frexp.h"
+
+LIST_FREXP_TESTS(double, __llvm_libc::frexp)

diff  --git a/libc/test/src/math/smoke/frexpf_test.cpp b/libc/test/src/math/smoke/frexpf_test.cpp
new file mode 100644
index 000000000000000..5d78f94ec1e596a
--- /dev/null
+++ b/libc/test/src/math/smoke/frexpf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for frexpf ----------------------------------------------===//
+//
+// 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/math/frexpf.h"
+
+LIST_FREXP_TESTS(float, __llvm_libc::frexpf)

diff  --git a/libc/test/src/math/smoke/frexpl_test.cpp b/libc/test/src/math/smoke/frexpl_test.cpp
new file mode 100644
index 000000000000000..4904ccd14907bb8
--- /dev/null
+++ b/libc/test/src/math/smoke/frexpl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for frexpl ----------------------------------------------===//
+//
+// 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/math/frexpl.h"
+
+LIST_FREXP_TESTS(long double, __llvm_libc::frexpl)

diff  --git a/libc/test/src/math/smoke/generic_sqrt_test.cpp b/libc/test/src/math/smoke/generic_sqrt_test.cpp
new file mode 100644
index 000000000000000..cecfc0ee3de3aee
--- /dev/null
+++ b/libc/test/src/math/smoke/generic_sqrt_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for generic implementation of sqrt ----------------------===//
+//
+// 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/generic/sqrt.h"
+
+LIST_SQRT_TESTS(double, __llvm_libc::fputil::sqrt<double>)

diff  --git a/libc/test/src/math/smoke/generic_sqrtf_test.cpp b/libc/test/src/math/smoke/generic_sqrtf_test.cpp
new file mode 100644
index 000000000000000..64bf92133b98f3e
--- /dev/null
+++ b/libc/test/src/math/smoke/generic_sqrtf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for generic implementation of sqrtf----------------------===//
+//
+// 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/generic/sqrt.h"
+
+LIST_SQRT_TESTS(float, __llvm_libc::fputil::sqrt<float>)

diff  --git a/libc/test/src/math/smoke/generic_sqrtl_test.cpp b/libc/test/src/math/smoke/generic_sqrtl_test.cpp
new file mode 100644
index 000000000000000..6b68aaed9700487
--- /dev/null
+++ b/libc/test/src/math/smoke/generic_sqrtl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for generic implementation of sqrtl----------------------===//
+//
+// 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/generic/sqrt.h"
+
+LIST_SQRT_TESTS(long double, __llvm_libc::fputil::sqrt<long double>)

diff  --git a/libc/test/src/math/smoke/hypot_test.cpp b/libc/test/src/math/smoke/hypot_test.cpp
new file mode 100644
index 000000000000000..f865b9f903e3563
--- /dev/null
+++ b/libc/test/src/math/smoke/hypot_test.cpp
@@ -0,0 +1,17 @@
+//===-- Unittests for hypot -----------------------------------------------===//
+//
+// 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 "HypotTest.h"
+
+#include "src/math/hypot.h"
+
+using LlvmLibcHypotTest = HypotTestTemplate<double>;
+
+TEST_F(LlvmLibcHypotTest, SpecialNumbers) {
+  test_special_numbers(&__llvm_libc::hypot);
+}

diff  --git a/libc/test/src/math/smoke/hypotf_test.cpp b/libc/test/src/math/smoke/hypotf_test.cpp
new file mode 100644
index 000000000000000..0c0ee3127cd4402
--- /dev/null
+++ b/libc/test/src/math/smoke/hypotf_test.cpp
@@ -0,0 +1,17 @@
+//===-- Unittests for hypotf ----------------------------------------------===//
+//
+// 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 "HypotTest.h"
+
+#include "src/math/hypotf.h"
+
+using LlvmLibcHypotfTest = HypotTestTemplate<float>;
+
+TEST_F(LlvmLibcHypotfTest, SpecialNumbers) {
+  test_special_numbers(&__llvm_libc::hypotf);
+}

diff  --git a/libc/test/src/math/smoke/ilogb_test.cpp b/libc/test/src/math/smoke/ilogb_test.cpp
new file mode 100644
index 000000000000000..a77adec4adba44d
--- /dev/null
+++ b/libc/test/src/math/smoke/ilogb_test.cpp
@@ -0,0 +1,36 @@
+//===-- Unittests for ilogb -----------------------------------------------===//
+//
+// 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/FPBits.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/math/ilogb.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) {
+  test_special_numbers<double>(&__llvm_libc::ilogb);
+}
+
+TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) {
+  test_powers_of_two<double>(&__llvm_libc::ilogb);
+}
+
+TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) {
+  test_some_integers<double>(&__llvm_libc::ilogb);
+}
+
+TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) {
+  test_subnormal_range<double>(&__llvm_libc::ilogb);
+}
+
+TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) {
+  test_normal_range<double>(&__llvm_libc::ilogb);
+}

diff  --git a/libc/test/src/math/smoke/ilogbf_test.cpp b/libc/test/src/math/smoke/ilogbf_test.cpp
new file mode 100644
index 000000000000000..20904a13c98a812
--- /dev/null
+++ b/libc/test/src/math/smoke/ilogbf_test.cpp
@@ -0,0 +1,36 @@
+//===-- Unittests for ilogbf ----------------------------------------------===//
+//
+// 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/FPBits.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/math/ilogbf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) {
+  test_special_numbers<float>(&__llvm_libc::ilogbf);
+}
+
+TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) {
+  test_powers_of_two<float>(&__llvm_libc::ilogbf);
+}
+
+TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) {
+  test_some_integers<float>(&__llvm_libc::ilogbf);
+}
+
+TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) {
+  test_subnormal_range<float>(&__llvm_libc::ilogbf);
+}
+
+TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) {
+  test_normal_range<float>(&__llvm_libc::ilogbf);
+}

diff  --git a/libc/test/src/math/smoke/ilogbl_test.cpp b/libc/test/src/math/smoke/ilogbl_test.cpp
new file mode 100644
index 000000000000000..9647f232245dc3e
--- /dev/null
+++ b/libc/test/src/math/smoke/ilogbl_test.cpp
@@ -0,0 +1,36 @@
+//===-- Unittests for ilogbl ----------------------------------------------===//
+//
+// 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/FPBits.h"
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/math/ilogbl.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) {
+  test_special_numbers<long double>(&__llvm_libc::ilogbl);
+}
+
+TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) {
+  test_powers_of_two<long double>(&__llvm_libc::ilogbl);
+}
+
+TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) {
+  test_some_integers<long double>(&__llvm_libc::ilogbl);
+}
+
+TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) {
+  test_subnormal_range<long double>(&__llvm_libc::ilogbl);
+}
+
+TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) {
+  test_normal_range<long double>(&__llvm_libc::ilogbl);
+}

diff  --git a/libc/test/src/math/smoke/ldexp_test.cpp b/libc/test/src/math/smoke/ldexp_test.cpp
new file mode 100644
index 000000000000000..c078aa4b7ef84c7
--- /dev/null
+++ b/libc/test/src/math/smoke/ldexp_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ldexp -----------------------------------------------===//
+//
+// 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/math/ldexp.h"
+
+LIST_LDEXP_TESTS(double, __llvm_libc::ldexp)

diff  --git a/libc/test/src/math/smoke/ldexpf_test.cpp b/libc/test/src/math/smoke/ldexpf_test.cpp
new file mode 100644
index 000000000000000..4fe80fc79151cd6
--- /dev/null
+++ b/libc/test/src/math/smoke/ldexpf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ldexpf ----------------------------------------------===//
+//
+// 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/math/ldexpf.h"
+
+LIST_LDEXP_TESTS(float, __llvm_libc::ldexpf)

diff  --git a/libc/test/src/math/smoke/ldexpl_test.cpp b/libc/test/src/math/smoke/ldexpl_test.cpp
new file mode 100644
index 000000000000000..5e6e6e75ae0855b
--- /dev/null
+++ b/libc/test/src/math/smoke/ldexpl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ldexpl ----------------------------------------------===//
+//
+// 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/math/ldexpl.h"
+
+LIST_LDEXP_TESTS(long double, __llvm_libc::ldexpl)

diff  --git a/libc/test/src/math/smoke/llrint_test.cpp b/libc/test/src/math/smoke/llrint_test.cpp
new file mode 100644
index 000000000000000..8027004bd50a5dd
--- /dev/null
+++ b/libc/test/src/math/smoke/llrint_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for llrint ----------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/llrint.h"
+
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long long, __llvm_libc::llrint)

diff  --git a/libc/test/src/math/smoke/llrintf_test.cpp b/libc/test/src/math/smoke/llrintf_test.cpp
new file mode 100644
index 000000000000000..9ad710e4698350c
--- /dev/null
+++ b/libc/test/src/math/smoke/llrintf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for llrintf ---------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/llrintf.h"
+
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long long, __llvm_libc::llrintf)

diff  --git a/libc/test/src/math/smoke/llrintl_test.cpp b/libc/test/src/math/smoke/llrintl_test.cpp
new file mode 100644
index 000000000000000..948e961e57bd4d0
--- /dev/null
+++ b/libc/test/src/math/smoke/llrintl_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for llrintl ---------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/llrintl.h"
+
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(long double, long long,
+                                       __llvm_libc::llrintl)

diff  --git a/libc/test/src/math/smoke/llround_test.cpp b/libc/test/src/math/smoke/llround_test.cpp
new file mode 100644
index 000000000000000..c86095dc9aae03b
--- /dev/null
+++ b/libc/test/src/math/smoke/llround_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for llround ---------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/llround.h"
+
+LIST_ROUND_TO_INTEGER_TESTS(double, long long, __llvm_libc::llround)

diff  --git a/libc/test/src/math/smoke/llroundf_test.cpp b/libc/test/src/math/smoke/llroundf_test.cpp
new file mode 100644
index 000000000000000..5e36258c246ae13
--- /dev/null
+++ b/libc/test/src/math/smoke/llroundf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for llroundf --------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/llroundf.h"
+
+LIST_ROUND_TO_INTEGER_TESTS(float, long long, __llvm_libc::llroundf)

diff  --git a/libc/test/src/math/smoke/llroundl_test.cpp b/libc/test/src/math/smoke/llroundl_test.cpp
new file mode 100644
index 000000000000000..8fbc840c4f2acc7
--- /dev/null
+++ b/libc/test/src/math/smoke/llroundl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for llroundl --------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/llroundl.h"
+
+LIST_ROUND_TO_INTEGER_TESTS(long double, long long, __llvm_libc::llroundl)

diff  --git a/libc/test/src/math/smoke/log10_test.cpp b/libc/test/src/math/smoke/log10_test.cpp
new file mode 100644
index 000000000000000..8a214748fb2e0b4
--- /dev/null
+++ b/libc/test/src/math/smoke/log10_test.cpp
@@ -0,0 +1,36 @@
+//===-- Unittests for log10 -----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/log10.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(double)
+
+TEST(LlvmLibcLog10Test, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::log10(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::log10(inf));
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(neg_inf), FE_INVALID);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(0.0), FE_DIVBYZERO);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(-0.0), FE_DIVBYZERO);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(-1.0), FE_INVALID);
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10(1.0));
+
+  double x = 1.0;
+  for (int i = 0; i < 11; ++i, x *= 10.0) {
+    EXPECT_FP_EQ_ALL_ROUNDING(static_cast<double>(i), __llvm_libc::log10(x));
+  }
+}

diff  --git a/libc/test/src/math/smoke/log10f_test.cpp b/libc/test/src/math/smoke/log10f_test.cpp
new file mode 100644
index 000000000000000..d7838140bec27f0
--- /dev/null
+++ b/libc/test/src/math/smoke/log10f_test.cpp
@@ -0,0 +1,34 @@
+//===-- Unittests for log10f ----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/math/log10f.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcLog10fTest, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::log10f(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::log10f(inf));
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(neg_inf), FE_INVALID);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(0.0f), FE_DIVBYZERO);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(-0.0f),
+                              FE_DIVBYZERO);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(-1.0f), FE_INVALID);
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10f(1.0f));
+
+  float x = 1.0f;
+  for (int i = 0; i < 11; ++i, x *= 10.0f) {
+    EXPECT_FP_EQ_ALL_ROUNDING(static_cast<float>(i), __llvm_libc::log10f(x));
+  }
+}

diff  --git a/libc/test/src/math/smoke/log1p_test.cpp b/libc/test/src/math/smoke/log1p_test.cpp
new file mode 100644
index 000000000000000..14e1977e060e7e4
--- /dev/null
+++ b/libc/test/src/math/smoke/log1p_test.cpp
@@ -0,0 +1,31 @@
+//===-- Unittests for log1p -----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/log1p.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(double)
+
+TEST(LlvmLibcLog1pTest, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::log1p(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::log1p(inf));
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(neg_inf), FE_INVALID);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(-2.0), FE_INVALID);
+  EXPECT_FP_EQ(zero, __llvm_libc::log1p(0.0));
+  EXPECT_FP_EQ(neg_zero, __llvm_libc::log1p(-0.0));
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1p(-1.0), FE_DIVBYZERO);
+}

diff  --git a/libc/test/src/math/smoke/log1pf_test.cpp b/libc/test/src/math/smoke/log1pf_test.cpp
new file mode 100644
index 000000000000000..22043ba6e278de0
--- /dev/null
+++ b/libc/test/src/math/smoke/log1pf_test.cpp
@@ -0,0 +1,29 @@
+//===-- Unittests for log1pf ----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/log1pf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibclog1pfTest, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::log1pf(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::log1pf(inf));
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1pf(neg_inf), FE_INVALID);
+  EXPECT_FP_EQ(zero, __llvm_libc::log1pf(0.0f));
+  EXPECT_FP_EQ(neg_zero, __llvm_libc::log1pf(-0.0f));
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1pf(-1.0f),
+                              FE_DIVBYZERO);
+}

diff  --git a/libc/test/src/math/smoke/log2_test.cpp b/libc/test/src/math/smoke/log2_test.cpp
new file mode 100644
index 000000000000000..2726a6b1c3a7267
--- /dev/null
+++ b/libc/test/src/math/smoke/log2_test.cpp
@@ -0,0 +1,31 @@
+//===-- Unittests for log2 ------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/log2.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(double)
+
+TEST(LlvmLibcLog2Test, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::log2(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::log2(inf));
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(neg_inf), FE_INVALID);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(0.0), FE_DIVBYZERO);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(-0.0), FE_DIVBYZERO);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(-1.0), FE_INVALID);
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2(1.0));
+}

diff  --git a/libc/test/src/math/smoke/log2f_test.cpp b/libc/test/src/math/smoke/log2f_test.cpp
new file mode 100644
index 000000000000000..6b05e6cc715ebe3
--- /dev/null
+++ b/libc/test/src/math/smoke/log2f_test.cpp
@@ -0,0 +1,28 @@
+//===-- Unittests for log2f -----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/log2f.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <stdint.h>
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcLog2fTest, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::log2f(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::log2f(inf));
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(neg_inf), FE_INVALID);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(0.0f), FE_DIVBYZERO);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(-0.0f), FE_DIVBYZERO);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(-1.0f), FE_INVALID);
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2f(1.0f));
+}

diff  --git a/libc/test/src/math/smoke/log_test.cpp b/libc/test/src/math/smoke/log_test.cpp
new file mode 100644
index 000000000000000..4277123214a67f4
--- /dev/null
+++ b/libc/test/src/math/smoke/log_test.cpp
@@ -0,0 +1,31 @@
+//===-- Unittests for log -------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/log.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using __llvm_libc::testing::tlog;
+
+DECLARE_SPECIAL_CONSTANTS(double)
+
+TEST(LlvmLibcLogTest, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::log(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::log(inf));
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(neg_inf), FE_INVALID);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(0.0), FE_DIVBYZERO);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(-0.0), FE_DIVBYZERO);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(-1.0), FE_INVALID);
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log(1.0));
+}

diff  --git a/libc/test/src/math/smoke/logb_test.cpp b/libc/test/src/math/smoke/logb_test.cpp
new file mode 100644
index 000000000000000..b90348522aa3aa6
--- /dev/null
+++ b/libc/test/src/math/smoke/logb_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for logb ------------------------------------------------===//
+//
+// 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/math/logb.h"
+
+LIST_LOGB_TESTS(double, __llvm_libc::logb)

diff  --git a/libc/test/src/math/smoke/logbf_test.cpp b/libc/test/src/math/smoke/logbf_test.cpp
new file mode 100644
index 000000000000000..727eefffbb1740c
--- /dev/null
+++ b/libc/test/src/math/smoke/logbf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for logbf -----------------------------------------------===//
+//
+// 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/math/logbf.h"
+
+LIST_LOGB_TESTS(float, __llvm_libc::logbf)

diff  --git a/libc/test/src/math/smoke/logbl_test.cpp b/libc/test/src/math/smoke/logbl_test.cpp
new file mode 100644
index 000000000000000..1c7b0d4e66e84ec
--- /dev/null
+++ b/libc/test/src/math/smoke/logbl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for logbl -----------------------------------------------===//
+//
+// 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/math/logbl.h"
+
+LIST_LOGB_TESTS(long double, __llvm_libc::logbl)

diff  --git a/libc/test/src/math/smoke/logf_test.cpp b/libc/test/src/math/smoke/logf_test.cpp
new file mode 100644
index 000000000000000..20fa51735ad75b4
--- /dev/null
+++ b/libc/test/src/math/smoke/logf_test.cpp
@@ -0,0 +1,27 @@
+//===-- Unittests for logf-----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/math/logf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <stdint.h>
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcLogfTest, SpecialNumbers) {
+  EXPECT_FP_EQ(aNaN, __llvm_libc::logf(aNaN));
+  EXPECT_FP_EQ(inf, __llvm_libc::logf(inf));
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(neg_inf), FE_INVALID);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(0.0f), FE_DIVBYZERO);
+  EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(-0.0f), FE_DIVBYZERO);
+  EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(-1.0f), FE_INVALID);
+  EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::logf(1.0f));
+}

diff  --git a/libc/test/src/math/smoke/lrint_test.cpp b/libc/test/src/math/smoke/lrint_test.cpp
new file mode 100644
index 000000000000000..0dbfa3dd466d99f
--- /dev/null
+++ b/libc/test/src/math/smoke/lrint_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for lrint -----------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/lrint.h"
+
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(double, long, __llvm_libc::lrint)

diff  --git a/libc/test/src/math/smoke/lrintf_test.cpp b/libc/test/src/math/smoke/lrintf_test.cpp
new file mode 100644
index 000000000000000..407813aa83c0feb
--- /dev/null
+++ b/libc/test/src/math/smoke/lrintf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for lrintf ----------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/lrintf.h"
+
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(float, long, __llvm_libc::lrintf)

diff  --git a/libc/test/src/math/smoke/lrintl_test.cpp b/libc/test/src/math/smoke/lrintl_test.cpp
new file mode 100644
index 000000000000000..a4551c38de10663
--- /dev/null
+++ b/libc/test/src/math/smoke/lrintl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for lrintl ----------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/lrintl.h"
+
+LIST_ROUND_TO_INTEGER_TESTS_WITH_MODES(long double, long, __llvm_libc::lrintl)

diff  --git a/libc/test/src/math/smoke/lround_test.cpp b/libc/test/src/math/smoke/lround_test.cpp
new file mode 100644
index 000000000000000..0ee580f316b44ac
--- /dev/null
+++ b/libc/test/src/math/smoke/lround_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for lround ----------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/lround.h"
+
+LIST_ROUND_TO_INTEGER_TESTS(double, long, __llvm_libc::lround)

diff  --git a/libc/test/src/math/smoke/lroundf_test.cpp b/libc/test/src/math/smoke/lroundf_test.cpp
new file mode 100644
index 000000000000000..7a2aad20e4f664b
--- /dev/null
+++ b/libc/test/src/math/smoke/lroundf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for lroundf ---------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/lroundf.h"
+
+LIST_ROUND_TO_INTEGER_TESTS(float, long, __llvm_libc::lroundf)

diff  --git a/libc/test/src/math/smoke/lroundl_test.cpp b/libc/test/src/math/smoke/lroundl_test.cpp
new file mode 100644
index 000000000000000..c0ea33978205236
--- /dev/null
+++ b/libc/test/src/math/smoke/lroundl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for lroundl ---------------------------------------------===//
+//
+// 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 "RoundToIntegerTest.h"
+
+#include "src/math/lroundl.h"
+
+LIST_ROUND_TO_INTEGER_TESTS(long double, long, __llvm_libc::lroundl)

diff  --git a/libc/test/src/math/smoke/modf_test.cpp b/libc/test/src/math/smoke/modf_test.cpp
new file mode 100644
index 000000000000000..ff89517506b4f27
--- /dev/null
+++ b/libc/test/src/math/smoke/modf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for modf ------------------------------------------------===//
+//
+// 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/math/modf.h"
+
+LIST_MODF_TESTS(double, __llvm_libc::modf)

diff  --git a/libc/test/src/math/smoke/modff_test.cpp b/libc/test/src/math/smoke/modff_test.cpp
new file mode 100644
index 000000000000000..440304ab95ac78f
--- /dev/null
+++ b/libc/test/src/math/smoke/modff_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for modff -----------------------------------------------===//
+//
+// 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/math/modff.h"
+
+LIST_MODF_TESTS(float, __llvm_libc::modff)

diff  --git a/libc/test/src/math/smoke/modfl_test.cpp b/libc/test/src/math/smoke/modfl_test.cpp
new file mode 100644
index 000000000000000..c98678b3e9243e3
--- /dev/null
+++ b/libc/test/src/math/smoke/modfl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for modfl -----------------------------------------------===//
+//
+// 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/math/modfl.h"
+
+LIST_MODF_TESTS(long double, __llvm_libc::modfl)

diff  --git a/libc/test/src/math/smoke/nextafter_test.cpp b/libc/test/src/math/smoke/nextafter_test.cpp
new file mode 100644
index 000000000000000..2dde48ceb053c6c
--- /dev/null
+++ b/libc/test/src/math/smoke/nextafter_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for nextafter -------------------------------------------===//
+//
+// 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 "NextAfterTest.h"
+
+#include "src/math/nextafter.h"
+
+LIST_NEXTAFTER_TESTS(double, __llvm_libc::nextafter)

diff  --git a/libc/test/src/math/smoke/nextafterf_test.cpp b/libc/test/src/math/smoke/nextafterf_test.cpp
new file mode 100644
index 000000000000000..14234c717797eb5
--- /dev/null
+++ b/libc/test/src/math/smoke/nextafterf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for nextafterf ------------------------------------------===//
+//
+// 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 "NextAfterTest.h"
+
+#include "src/math/nextafterf.h"
+
+LIST_NEXTAFTER_TESTS(float, __llvm_libc::nextafterf)

diff  --git a/libc/test/src/math/smoke/nextafterl_test.cpp b/libc/test/src/math/smoke/nextafterl_test.cpp
new file mode 100644
index 000000000000000..db85d83edc690ef
--- /dev/null
+++ b/libc/test/src/math/smoke/nextafterl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for nextafterl ------------------------------------------===//
+//
+// 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 "NextAfterTest.h"
+
+#include "src/math/nextafterl.h"
+
+LIST_NEXTAFTER_TESTS(long double, __llvm_libc::nextafterl)

diff  --git a/libc/test/src/math/smoke/remquo_test.cpp b/libc/test/src/math/smoke/remquo_test.cpp
new file mode 100644
index 000000000000000..8efec397f39d33b
--- /dev/null
+++ b/libc/test/src/math/smoke/remquo_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for remquo ----------------------------------------------===//
+//
+// 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/math/remquo.h"
+
+LIST_REMQUO_TESTS(double, __llvm_libc::remquo)

diff  --git a/libc/test/src/math/smoke/remquof_test.cpp b/libc/test/src/math/smoke/remquof_test.cpp
new file mode 100644
index 000000000000000..1af4ba4e0153b55
--- /dev/null
+++ b/libc/test/src/math/smoke/remquof_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for remquof ---------------------------------------------===//
+//
+// 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/math/remquof.h"
+
+LIST_REMQUO_TESTS(float, __llvm_libc::remquof)

diff  --git a/libc/test/src/math/smoke/remquol_test.cpp b/libc/test/src/math/smoke/remquol_test.cpp
new file mode 100644
index 000000000000000..e4438e83fe18ce1
--- /dev/null
+++ b/libc/test/src/math/smoke/remquol_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for remquol ---------------------------------------------===//
+//
+// 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/math/remquol.h"
+
+LIST_REMQUO_TESTS(long double, __llvm_libc::remquol)

diff  --git a/libc/test/src/math/smoke/rint_test.cpp b/libc/test/src/math/smoke/rint_test.cpp
new file mode 100644
index 000000000000000..eafa1a7fe6119fe
--- /dev/null
+++ b/libc/test/src/math/smoke/rint_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for rint ------------------------------------------------===//
+//
+// 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 "RIntTest.h"
+
+#include "src/math/rint.h"
+
+LIST_RINT_TESTS(double, __llvm_libc::rint)

diff  --git a/libc/test/src/math/smoke/rintf_test.cpp b/libc/test/src/math/smoke/rintf_test.cpp
new file mode 100644
index 000000000000000..c15a697fac9208c
--- /dev/null
+++ b/libc/test/src/math/smoke/rintf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for rintf -----------------------------------------------===//
+//
+// 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 "RIntTest.h"
+
+#include "src/math/rintf.h"
+
+LIST_RINT_TESTS(float, __llvm_libc::rintf)

diff  --git a/libc/test/src/math/smoke/rintl_test.cpp b/libc/test/src/math/smoke/rintl_test.cpp
new file mode 100644
index 000000000000000..6c50873a272d046
--- /dev/null
+++ b/libc/test/src/math/smoke/rintl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for rintl -----------------------------------------------===//
+//
+// 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 "RIntTest.h"
+
+#include "src/math/rintl.h"
+
+LIST_RINT_TESTS(long double, __llvm_libc::rintl)

diff  --git a/libc/test/src/math/smoke/round_test.cpp b/libc/test/src/math/smoke/round_test.cpp
new file mode 100644
index 000000000000000..87ce079e89afc29
--- /dev/null
+++ b/libc/test/src/math/smoke/round_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for round -----------------------------------------------===//
+//
+// 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 "RoundTest.h"
+
+#include "src/math/round.h"
+
+LIST_ROUND_TESTS(double, __llvm_libc::round)

diff  --git a/libc/test/src/math/smoke/roundf_test.cpp b/libc/test/src/math/smoke/roundf_test.cpp
new file mode 100644
index 000000000000000..0a182dd02deee6f
--- /dev/null
+++ b/libc/test/src/math/smoke/roundf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for roundf ----------------------------------------------===//
+//
+// 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 "RoundTest.h"
+
+#include "src/math/roundf.h"
+
+LIST_ROUND_TESTS(float, __llvm_libc::roundf)

diff  --git a/libc/test/src/math/smoke/roundl_test.cpp b/libc/test/src/math/smoke/roundl_test.cpp
new file mode 100644
index 000000000000000..32cf724fb7c4f3b
--- /dev/null
+++ b/libc/test/src/math/smoke/roundl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for roundl ----------------------------------------------===//
+//
+// 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 "RoundTest.h"
+
+#include "src/math/roundl.h"
+
+LIST_ROUND_TESTS(long double, __llvm_libc::roundl)

diff  --git a/libc/test/src/math/smoke/scalbn_test.cpp b/libc/test/src/math/smoke/scalbn_test.cpp
new file mode 100644
index 000000000000000..d4d60bf8afca180
--- /dev/null
+++ b/libc/test/src/math/smoke/scalbn_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalbn ----------------------------------------------===//
+//
+// 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/math/scalbn.h"
+
+LIST_SCALBN_TESTS(double, __llvm_libc::scalbn)

diff  --git a/libc/test/src/math/smoke/scalbnf_test.cpp b/libc/test/src/math/smoke/scalbnf_test.cpp
new file mode 100644
index 000000000000000..cbf2e7e1361e10c
--- /dev/null
+++ b/libc/test/src/math/smoke/scalbnf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalbnf ---------------------------------------------===//
+//
+// 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/math/scalbnf.h"
+
+LIST_SCALBN_TESTS(float, __llvm_libc::scalbnf)

diff  --git a/libc/test/src/math/smoke/scalbnl_test.cpp b/libc/test/src/math/smoke/scalbnl_test.cpp
new file mode 100644
index 000000000000000..197887b2448c057
--- /dev/null
+++ b/libc/test/src/math/smoke/scalbnl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for scalbnl ---------------------------------------------===//
+//
+// 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/math/scalbnl.h"
+
+LIST_SCALBN_TESTS(long double, __llvm_libc::scalbnl)

diff  --git a/libc/test/src/math/smoke/sincosf_test.cpp b/libc/test/src/math/smoke/sincosf_test.cpp
new file mode 100644
index 000000000000000..102a50c428d26ac
--- /dev/null
+++ b/libc/test/src/math/smoke/sincosf_test.cpp
@@ -0,0 +1,51 @@
+//===-- Unittests for sincosf ---------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/sincosf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
+  libc_errno = 0;
+  float sin, cos;
+
+  __llvm_libc::sincosf(aNaN, &sin, &cos);
+  EXPECT_FP_EQ(aNaN, cos);
+  EXPECT_FP_EQ(aNaN, sin);
+  EXPECT_MATH_ERRNO(0);
+
+  __llvm_libc::sincosf(0.0f, &sin, &cos);
+  EXPECT_FP_EQ(1.0f, cos);
+  EXPECT_FP_EQ(0.0f, sin);
+  EXPECT_MATH_ERRNO(0);
+
+  __llvm_libc::sincosf(-0.0f, &sin, &cos);
+  EXPECT_FP_EQ(1.0f, cos);
+  EXPECT_FP_EQ(-0.0f, sin);
+  EXPECT_MATH_ERRNO(0);
+
+  __llvm_libc::sincosf(inf, &sin, &cos);
+  EXPECT_FP_EQ(aNaN, cos);
+  EXPECT_FP_EQ(aNaN, sin);
+  EXPECT_MATH_ERRNO(EDOM);
+
+  __llvm_libc::sincosf(neg_inf, &sin, &cos);
+  EXPECT_FP_EQ(aNaN, cos);
+  EXPECT_FP_EQ(aNaN, sin);
+  EXPECT_MATH_ERRNO(EDOM);
+}

diff  --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp
new file mode 100644
index 000000000000000..e67062d74190bb9
--- /dev/null
+++ b/libc/test/src/math/smoke/sinf_test.cpp
@@ -0,0 +1,40 @@
+//===-- Unittests for sinf ------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/sinf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcSinfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(0.0f, __llvm_libc::sinf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(-0.0f, __llvm_libc::sinf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(inf));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(neg_inf));
+  EXPECT_MATH_ERRNO(EDOM);
+}

diff  --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp
new file mode 100644
index 000000000000000..5926ea647490bc2
--- /dev/null
+++ b/libc/test/src/math/smoke/sinhf_test.cpp
@@ -0,0 +1,67 @@
+//===-- Unittests for sinhf -----------------------------------------------===//
+//
+// 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/__support/CPP/array.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/sinhf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcSinhfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ(aNaN, __llvm_libc::sinhf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(0.0f, __llvm_libc::sinhf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(-0.0f, __llvm_libc::sinhf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(inf, __llvm_libc::sinhf(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(neg_inf, __llvm_libc::sinhf(neg_inf));
+  EXPECT_MATH_ERRNO(0);
+}
+
+// For small values, sinh(x) is x.
+TEST(LlvmLibcSinhfTest, SmallValues) {
+  float x = float(FPBits(uint32_t(0x17800000)));
+  float result = __llvm_libc::sinhf(x);
+  EXPECT_FP_EQ(x, result);
+
+  x = float(FPBits(uint32_t(0x00400000)));
+  result = __llvm_libc::sinhf(x);
+  EXPECT_FP_EQ(x, result);
+}
+
+TEST(LlvmLibcSinhfTest, Overflow) {
+  libc_errno = 0;
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+
+  EXPECT_FP_EQ_WITH_EXCEPTION(
+      inf, __llvm_libc::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW);
+  EXPECT_MATH_ERRNO(ERANGE);
+}

diff  --git a/libc/test/src/math/smoke/sqrt_test.cpp b/libc/test/src/math/smoke/sqrt_test.cpp
new file mode 100644
index 000000000000000..237264895bbd26b
--- /dev/null
+++ b/libc/test/src/math/smoke/sqrt_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for sqrt ------------------------------------------------===//
+//
+// 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/math/sqrt.h"
+
+LIST_SQRT_TESTS(double, __llvm_libc::sqrt)

diff  --git a/libc/test/src/math/smoke/sqrtf_test.cpp b/libc/test/src/math/smoke/sqrtf_test.cpp
new file mode 100644
index 000000000000000..c7681d01569ae73
--- /dev/null
+++ b/libc/test/src/math/smoke/sqrtf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for sqrtf------------------------------------------------===//
+//
+// 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/math/sqrtf.h"
+
+LIST_SQRT_TESTS(float, __llvm_libc::sqrtf)

diff  --git a/libc/test/src/math/smoke/sqrtl_test.cpp b/libc/test/src/math/smoke/sqrtl_test.cpp
new file mode 100644
index 000000000000000..c48ebb08444d051
--- /dev/null
+++ b/libc/test/src/math/smoke/sqrtl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for sqrtl------------------------------------------------===//
+//
+// 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/math/sqrtl.h"
+
+LIST_SQRT_TESTS(long double, __llvm_libc::sqrtl)

diff  --git a/libc/test/src/math/smoke/tanf_test.cpp b/libc/test/src/math/smoke/tanf_test.cpp
new file mode 100644
index 000000000000000..62cc42c0bef1a48
--- /dev/null
+++ b/libc/test/src/math/smoke/tanf_test.cpp
@@ -0,0 +1,40 @@
+//===-- Unittests for tanf ------------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/tanf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcTanfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(0.0f, __llvm_libc::tanf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(-0.0f, __llvm_libc::tanf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(inf));
+  EXPECT_MATH_ERRNO(EDOM);
+
+  EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(neg_inf));
+  EXPECT_MATH_ERRNO(EDOM);
+}

diff  --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp
new file mode 100644
index 000000000000000..0152de2f5ea04cc
--- /dev/null
+++ b/libc/test/src/math/smoke/tanhf_test.cpp
@@ -0,0 +1,40 @@
+//===-- Unittests for tanhf -----------------------------------------------===//
+//
+// 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/__support/FPUtil/FPBits.h"
+#include "src/errno/libc_errno.h"
+#include "src/math/tanhf.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <math.h>
+
+#include <errno.h>
+#include <stdint.h>
+
+using FPBits = __llvm_libc::fputil::FPBits<float>;
+
+DECLARE_SPECIAL_CONSTANTS(float)
+
+TEST(LlvmLibcTanhfTest, SpecialNumbers) {
+  libc_errno = 0;
+
+  EXPECT_FP_EQ(aNaN, __llvm_libc::tanhf(aNaN));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(0.0f, __llvm_libc::tanhf(0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(-0.0f, __llvm_libc::tanhf(-0.0f));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(1.0f, __llvm_libc::tanhf(inf));
+  EXPECT_MATH_ERRNO(0);
+
+  EXPECT_FP_EQ(-1.0f, __llvm_libc::tanhf(neg_inf));
+  EXPECT_MATH_ERRNO(0);
+}

diff  --git a/libc/test/src/math/smoke/trunc_test.cpp b/libc/test/src/math/smoke/trunc_test.cpp
new file mode 100644
index 000000000000000..f0a808dcb23684c
--- /dev/null
+++ b/libc/test/src/math/smoke/trunc_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for trunc -----------------------------------------------===//
+//
+// 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 "TruncTest.h"
+
+#include "src/math/trunc.h"
+
+LIST_TRUNC_TESTS(double, __llvm_libc::trunc)

diff  --git a/libc/test/src/math/smoke/truncf_test.cpp b/libc/test/src/math/smoke/truncf_test.cpp
new file mode 100644
index 000000000000000..cbd672cfe2e21ef
--- /dev/null
+++ b/libc/test/src/math/smoke/truncf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for truncf ----------------------------------------------===//
+//
+// 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 "TruncTest.h"
+
+#include "src/math/truncf.h"
+
+LIST_TRUNC_TESTS(float, __llvm_libc::truncf)

diff  --git a/libc/test/src/math/smoke/truncl_test.cpp b/libc/test/src/math/smoke/truncl_test.cpp
new file mode 100644
index 000000000000000..0cf9ab8cd5575ba
--- /dev/null
+++ b/libc/test/src/math/smoke/truncl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for truncl ----------------------------------------------===//
+//
+// 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 "TruncTest.h"
+
+#include "src/math/truncl.h"
+
+LIST_TRUNC_TESTS(long double, __llvm_libc::truncl)


        


More information about the libc-commits mailing list