[libc][math] Integer-only, statically rounded implementation of expf (#209406)
Integer-only, statically rounded implementation of `expf`, using 1
single `Frac64`-based pipeline
# Accuracy
All unit, smoke, and exhaustive tests against
`LIBC_NAMESPACE::shared::expf` pass for all rounding modes.
# Code size:
> [!NOTE]
> The report below are from the`armv8m.main-none-eabi` triple.
## Before the patch
```sh
$ ls -lB libc/src/math/generic/CMakeFiles/libc.src.math.generic.expf.dir/
total 16
-rw-r-----@ 1 davidhoang staff 5520 Jul 24 15:59 expf.cpp.obj
$ llvm-nm --radix=d --print-size --size-sort --reverse-sort libc/src/math/generic/CMakeFiles/libc.src.math.generic.expf.dir/expf.cpp.obj
00000000 00001560 V _ZN22__llvm_libc_24_0_0_git4math6EXP_M1E
00000000 00001024 V _ZN22__llvm_libc_24_0_0_git4math6EXP_M2E
00000000 00000628 W _ZN22__llvm_libc_24_0_0_git4math4expfEf
00000000 00000012 T expf
00000000 00000012 T _ZN22__llvm_libc_24_0_0_git4expfEf
00000000 00000004 V _ZZN22__llvm_libc_24_0_0_git6fputil7generic16fenv_is_round_upEvE1x
00000000 00000004 V _ZZN22__llvm_libc_24_0_0_git6fputil7generic15quick_get_roundEvE1x
U __aeabi_f2d
U __aeabi_dmul
U __aeabi_dadd
U __aeabi_d2f
```
## After the patch and with `LIBC_MATH_FAST`
```sh
$ ls -lB libc/src/math/generic/CMakeFiles/libc.src.math.generic.expf.dir/
total 8
-rw-r-----@ 1 davidhoang staff 3244 Aug 18 14:29 expf.cpp.obj
$ llvm-nm --radix=d --print-size --size-sort --reverse-sort libc/src/math/generic/CMakeFiles/libc.src.math.generic.expf.dir/expf.cpp.obj
00000000 00001916 W _ZN22__llvm_libc_24_0_0_git6shared4math15static_rounding4expfEfi
00000000 00000014 T expf
00000000 00000014 T _ZN22__llvm_libc_24_0_0_git4expfEf
```
# Latency
[bench.zip](https://github.com/user-attachments/files/31171370/bench.zip),
containing `bench.cc` with compilation instruction.
```
====================LIBC_MATH_FAST is ON====================
==========================baseline==========================
overflow [88,100] 51.67 ns/call (19M ops/sec)
underflow [-110,-100] 55.50 ns/call (18M ops/sec)
normal [-10,10] 32.09 ns/call (31M ops/sec)
subnormal-result [-103,-87] 40.14 ns/call (25M ops/sec)
near-underflow [-100,-80] 40.84 ns/call (24M ops/sec)
======================static_rounding=======================
overflow [88,100] 142.13 ns/call (7M ops/sec)
underflow [-110,-100] 431.57 ns/call (2M ops/sec)
normal [-10,10] 925.12 ns/call (1M ops/sec)
subnormal-result [-103,-87] 965.58 ns/call (1M ops/sec)
near-underflow [-100,-80] 955.55 ns/call (1M ops/sec)
```
```
===================LIBC_MATH_FAST is OFF====================
==========================baseline==========================
overflow [88,100] 55.99 ns/call (18M ops/sec)
underflow [-110,-100] 58.80 ns/call (17M ops/sec)
normal [-10,10] 32.70 ns/call (31M ops/sec)
subnormal-result [-103,-87] 40.90 ns/call (24M ops/sec)
near-underflow [-100,-80] 40.46 ns/call (25M ops/sec)
======================static_rounding=======================
overflow [88,100] 141.72 ns/call (7M ops/sec)
underflow [-110,-100] 432.78 ns/call (2M ops/sec)
normal [-10,10] 935.92 ns/call (1M ops/sec)
subnormal-result [-103,-87] 971.07 ns/call (1M ops/sec)
near-underflow [-100,-80] 966.82 ns/call (1M ops/sec)
```
Benchmarking system: MacBook Air M3, macOS 26.5.1