Skip to content

Commit c3abe3f

Browse files
authored
[libc][math][c23] implement C23 math function tanpif (#147192)
The smoke test and exhaustive test pass on x86_64 Linux. Closes #94895.
1 parent 265fb36 commit c3abe3f

File tree

18 files changed

+358
-1
lines changed

18 files changed

+358
-1
lines changed

libc/config/darwin/aarch64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ set(TARGET_LIBM_ENTRYPOINTS
363363
libc.src.math.tan
364364
libc.src.math.tanf
365365
libc.src.math.tanhf
366+
libc.src.math.tanpif
366367
libc.src.math.totalorder
367368
libc.src.math.totalorderf
368369
libc.src.math.totalorderl

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ set(TARGET_LIBM_ENTRYPOINTS
625625
libc.src.math.tan
626626
libc.src.math.tanf
627627
libc.src.math.tanhf
628+
libc.src.math.tanpif
628629
libc.src.math.totalorder
629630
libc.src.math.totalorderf
630631
libc.src.math.totalorderl

libc/config/linux/arm/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ set(TARGET_LIBM_ENTRYPOINTS
437437
libc.src.math.tan
438438
libc.src.math.tanf
439439
libc.src.math.tanhf
440+
libc.src.math.tanpif
440441
libc.src.math.totalorder
441442
libc.src.math.totalorderf
442443
libc.src.math.totalorderl

libc/config/linux/riscv/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ set(TARGET_LIBM_ENTRYPOINTS
635635
libc.src.math.tan
636636
libc.src.math.tanf
637637
libc.src.math.tanhf
638+
libc.src.math.tanpif
638639
libc.src.math.totalorder
639640
libc.src.math.totalorderf
640641
libc.src.math.totalorderl

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ set(TARGET_LIBM_ENTRYPOINTS
659659
libc.src.math.tan
660660
libc.src.math.tanf
661661
libc.src.math.tanhf
662+
libc.src.math.tanpif
662663
libc.src.math.totalorder
663664
libc.src.math.totalorderf
664665
libc.src.math.totalorderl

libc/config/windows/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ set(TARGET_LIBM_ENTRYPOINTS
295295
libc.src.math.tan
296296
libc.src.math.tanf
297297
libc.src.math.tanhf
298+
libc.src.math.tanpif
298299
libc.src.math.trunc
299300
libc.src.math.truncf
300301
libc.src.math.truncl

libc/docs/headers/math/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ Higher Math Functions
349349
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
350350
| tanh | |check| | | | |check| | | 7.12.5.6 | F.10.2.6 |
351351
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
352-
| tanpi | | | | |check| | | 7.12.4.14 | F.10.1.14 |
352+
| tanpi | |check| | | | |check| | | 7.12.4.14 | F.10.1.14 |
353353
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
354354
| tgamma | | | | | | 7.12.8.4 | F.10.5.4 |
355355
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+

libc/include/math.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,6 +2524,12 @@ functions:
25242524
arguments:
25252525
- type: _Float16
25262526
guard: LIBC_TYPES_HAS_FLOAT16
2527+
- name: tanpif
2528+
standards:
2529+
- stdc
2530+
return_type: float
2531+
arguments:
2532+
- type: float
25272533
- name: tanpif16
25282534
standards:
25292535
- stdc

libc/src/math/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ add_math_entrypoint_object(tanf16)
519519
add_math_entrypoint_object(tanh)
520520
add_math_entrypoint_object(tanhf)
521521
add_math_entrypoint_object(tanhf16)
522+
523+
add_math_entrypoint_object(tanpif)
522524
add_math_entrypoint_object(tanpif16)
523525

524526
add_math_entrypoint_object(tgamma)

libc/src/math/generic/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,21 @@ add_entrypoint_object(
606606
libc.src.__support.macros.properties.types
607607
)
608608

609+
add_entrypoint_object(
610+
tanpif
611+
SRCS
612+
tanpif.cpp
613+
HDRS
614+
../tanpif.h
615+
DEPENDS
616+
.sincosf_utils
617+
libc.src.__support.FPUtil.except_value_utils
618+
libc.src.__support.FPUtil.fenv_impl
619+
libc.src.__support.FPUtil.fp_bits
620+
libc.src.__support.FPUtil.multiply_add
621+
libc.src.__support.macros.optimization
622+
)
623+
609624
add_entrypoint_object(
610625
tanpif16
611626
SRCS

0 commit comments

Comments
 (0)