[libc-commits] [libc] [libc][math] Add iscanonical functions to math.yaml (PR #199317)
via libc-commits
libc-commits at lists.llvm.org
Fri May 22 22:43:34 PDT 2026
https://github.com/jofrn updated https://github.com/llvm/llvm-project/pull/199317
>From d27f84cd5b8ec1a213673a554cc849632fe09a6d Mon Sep 17 00:00:00 2001
From: jofrn <jo7frn1 at gmail.com>
Date: Fri, 22 May 2026 19:48:45 -0700
Subject: [PATCH] [libc][math] Add iscanonical functions to math.yaml
Surface the existing iscanonical, iscanonicalf, iscanonicalf128, iscanonicalf16, and iscanonicall
implementations through the generated math.h.
To test:
`cmake -Bbuild -Sruntimes -GNinja -DLLVM_ENABLE_RUNTIMES=libc -DLLVM_LIBC_FULL_BUILD=ON`
`pip install pyyaml`
`ninja -C build libc.include.math.__generated_hdr__`
Then check `build/libc/include/math.h` for their signatures.
Add `-DLIBC_TYPES_HAS_FLOAT128=ON` to test for iscanonicalf128
in cmake invocation if host does not support it.
And `LIBC_TYPES_HAS_FLOAT16=ON` for iscanonicalf16.
---
libc/include/math.yaml | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/libc/include/math.yaml b/libc/include/math.yaml
index 36ff380a1b305..0d9181f1ff173 100644
--- a/libc/include/math.yaml
+++ b/libc/include/math.yaml
@@ -1588,6 +1588,38 @@ functions:
return_type: int
arguments:
- type: long double
+ - name: iscanonical
+ standards:
+ - stdc
+ return_type: int
+ arguments:
+ - type: double
+ - name: iscanonicalf
+ standards:
+ - stdc
+ return_type: int
+ arguments:
+ - type: float
+ - name: iscanonicalf128
+ standards:
+ - stdc
+ return_type: int
+ arguments:
+ - type: float128
+ guard: LIBC_TYPES_HAS_FLOAT128
+ - name: iscanonicalf16
+ standards:
+ - stdc
+ return_type: int
+ arguments:
+ - type: _Float16
+ guard: LIBC_TYPES_HAS_FLOAT16
+ - name: iscanonicall
+ standards:
+ - stdc
+ return_type: int
+ arguments:
+ - type: long double
- name: isnan
standards:
- bsd
More information about the libc-commits
mailing list