Skip to content

[libc] Add half-precision math functions to the math header - #155060

Merged
jhuber6 merged 1 commit into
llvm:mainfrom
leandrolcampos:MoreFloat16
Aug 23, 2025
Merged

[libc] Add half-precision math functions to the math header#155060
jhuber6 merged 1 commit into
llvm:mainfrom
leandrolcampos:MoreFloat16

Conversation

@leandrolcampos

Copy link
Copy Markdown
Contributor

This patch adds the exp10f16, exp2f16, expf16, and expm1f16 math functions to the math.h header.

@llvmbot llvmbot added the libc label Aug 23, 2025
@llvmbot

llvmbot commented Aug 23, 2025

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-libc

Author: Leandro Lacerda (leandrolcampos)

Changes

This patch adds the exp10f16, exp2f16, expf16, and expm1f16 math functions to the math.h header.


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

1 Files Affected:

  • (modified) libc/include/math.yaml (+28)
diff --git a/libc/include/math.yaml b/libc/include/math.yaml
index 60e6265eece75..6f48e0e9fd35f 100644
--- a/libc/include/math.yaml
+++ b/libc/include/math.yaml
@@ -370,6 +370,13 @@ functions:
     return_type: float
     arguments:
       - type: float
+  - name: exp10f16
+    standards:
+      - stdc
+    return_type: _Float16
+    arguments:
+      - type: _Float16
+    guard: LIBC_TYPES_HAS_FLOAT16
   - name: exp10m1f
     standards:
       - stdc
@@ -395,6 +402,13 @@ functions:
     return_type: float
     arguments:
       - type: float
+  - name: exp2f16
+    standards:
+      - stdc
+    return_type: _Float16
+    arguments:
+      - type: _Float16
+    guard: LIBC_TYPES_HAS_FLOAT16
   - name: exp2m1f
     standards:
       - stdc
@@ -414,6 +428,13 @@ functions:
     return_type: float
     arguments:
       - type: float
+  - name: expf16
+    standards:
+      - stdc
+    return_type: _Float16
+    arguments:
+      - type: _Float16
+    guard: LIBC_TYPES_HAS_FLOAT16
   - name: expm1
     standards:
       - stdc
@@ -426,6 +447,13 @@ functions:
     return_type: float
     arguments:
       - type: float
+  - name: expm1f16
+    standards:
+      - stdc
+    return_type: _Float16
+    arguments:
+      - type: _Float16
+    guard: LIBC_TYPES_HAS_FLOAT16
   - name: f16add
     standards:
       - llvm_libc_ext

@jhuber6
jhuber6 merged commit 9dc66a6 into llvm:main Aug 23, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants