[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 21:07:28 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: jofrn

<details>
<summary>Changes</summary>

[libc][math] Add iscanonical functions to math.yaml
    
    Surface the existing iscanonical, iscanonicalf, iscanonicalf128,
    iscanonicalf16, and iscanonicall implementations through the
    generated math.h. Addresses part of #<!-- -->199266.
    
    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__`
    
    Add `-DLIBC_TYPES_HAS_FLOAT128=ON` to test for iscanonicalf128
    in cmake invocation if host does not support it.

---
Full diff: https://github.com/llvm/llvm-project/pull/199317.diff


1 Files Affected:

- (modified) libc/include/math.yaml (+32) 


``````````diff
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

``````````

</details>


https://github.com/llvm/llvm-project/pull/199317


More information about the libc-commits mailing list