llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[libc][math] Add Missing math functions to math.yaml

Open Sukumarsawant opened this issue 6 months ago • 22 comments

Some of the missing functions

  • [x] Trigonometric Functions: https://github.com/llvm/llvm-project/pull/199442

    • acospif
    • atan2f16
  • [x] Error, Gamma Functions and fma: https://github.com/llvm/llvm-project/pull/199485

    • dfmaf128
    • dfmal
  • [ ] ~~Canonical : https://github.com/llvm/llvm-project/pull/199317~~

    • iscanonical
    • iscanonicalf
    • iscanonicalf128
    • iscanonicalf16
    • iscanonicall
  • [ ] ~~Signaling: https://github.com/llvm/llvm-project/pull/199357~~

    • issignaling
    • issignalingf
    • issignalingf128
    • issignalingf16
    • issignalingl

Feel free to add any additional missing functions apart from this. Make sure to adhere to LLVM AI Tool Use Policy.

Sukumarsawant avatar May 22 '26 19:05 Sukumarsawant

@llvm/issue-subscribers-libc

Author: Zorojuro (Sukumarsawant)

Some of the missing functions - acosh - acospif - asinh - atan2f16 - atanh - cosh - dfmaf128 - dfmal - erf - iscanonical - iscanonicalf - iscanonicalf128 - iscanonicalf16 - iscanonicall - issignaling - issignalingf - issignalingf128 - issignalingf16 - issignalingl - sinh - tanh - tgamma - tgammaf

Feel free to add any additional missing function apart from this.

Adding iscanonical in https://github.com/llvm/llvm-project/pull/199317 . : )

jofrn avatar May 23 '26 04:05 jofrn

Hi! I observed that there exists

- name: atan2f128
    standards:
      - stdc
    return_type: float128
    arguments:
      - type: float128
      - type: float128
    guard: LIBC_TYPES_HAS_FLOAT128

but no other transcendental function supports float128.

I'll go ahead and add the _Float128 variants of most/all functions mentioned in the first comment in this thread.

skandanyal avatar May 23 '26 09:05 skandanyal

Hi, I’d like to work on the sinh, asinh, cosh, acosh, tanh, and atanh functions. Could you please assign this issue to me?

iamaayushrivastava avatar May 23 '26 09:05 iamaayushrivastava

@ArnavM21git you can work on Error, Gamma Functions and fma,

@skandanyal on issignalling family

and @iamaayushrivastava on trigonometric ones, It would be better to review separately.

Sukumarsawant avatar May 23 '26 10:05 Sukumarsawant

Adding Error, Gamma Functions and Fma in math.yaml in https://github.com/llvm/llvm-project/pull/199340#issue-4507829433

ArnavM21git avatar May 23 '26 11:05 ArnavM21git

Hello! Thank you for assigning the work. I'll take it up and execute it at my earliest convenience.

skandanyal avatar May 23 '26 12:05 skandanyal

Hi! I observed that there exists

  • name: atan2f128 standards: - stdc return_type: float128 arguments: - type: float128 - type: float128 guard: LIBC_TYPES_HAS_FLOAT128 but no other transcendental function supports float128.

I'll go ahead and add the _Float128 variants of most/all functions mentioned in the first comment in this thread.

feel free to add a comment listing the functions here so can add into the tracking issue

Sukumarsawant avatar May 23 '26 12:05 Sukumarsawant

Hi! I observed that there exists

  • name: atan2f128 standards:
    • stdc return_type: float128 arguments:
    • type: float128
    • type: float128 guard: LIBC_TYPES_HAS_FLOAT128 but no other transcendental function supports float128.

I'll go ahead and add the _Float128 variants of most/all functions mentioned in the first comment in this thread.

feel free to add a comment listing the functions here so can add into the tracking issue

Um... I'm sorry, I got confused and I happened to close that particular branch. But here are the functions which were originally added -

  • atanhf128
  • acoshf128
  • acosf128
  • asinf128
  • asinhf128
  • cosf128
  • coshf128
  • cospif128
  • sinf128
  • sinhf128
  • sinpif128
  • tanf128
  • tanhf128
  • tanpif128

I can take up the job to add them to math.yaml, and even implement them further if required.

skandanyal avatar May 23 '26 14:05 skandanyal

@ArnavM21git you can work on Error, Gamma Functions and fma,

@skandanyal on issignalling family

and @iamaayushrivastava on trigonometric ones, It would be better to review separately.

Hi, thank you for assigning the work. I've started working on the trigonometric functions.

iamaayushrivastava avatar May 23 '26 14:05 iamaayushrivastava

Hi! I observed that there exists

  • name: atan2f128 standards:

    • stdc return_type: float128 arguments:
    • type: float128
    • type: float128 guard: LIBC_TYPES_HAS_FLOAT128 but no other transcendental function supports float128.

I'll go ahead and add the _Float128 variants of most/all functions mentioned in the first comment in this thread.

feel free to add a comment listing the functions here so can add into the tracking issue

Um... I'm sorry, I got confused and I happened to close that particular branch. But here are the functions which were originally added -

  • atanhf128
  • acoshf128
  • acosf128
  • asinf128
  • asinhf128
  • cosf128
  • coshf128
  • cospif128
  • sinf128
  • sinhf128
  • sinpif128
  • tanf128
  • tanhf128
  • tanpif128

I can take up the job to add them to math.yaml, and even implement them further if required.

They haven't been implemented yet, and also hold f128 for now. You can try some other functions . There's one tgammabf16 if you want to try implementing some (#199245)

Sukumarsawant avatar May 23 '26 14:05 Sukumarsawant

@Sukumarsawant any left that i can work on ?

Ko496-glitch avatar May 24 '26 17:05 Ko496-glitch

@Sukumarsawant any left that i can work on ?

All are taken already. You can add any missing ones from the description though. (Which are implemented)

Sukumarsawant avatar May 24 '26 19:05 Sukumarsawant

Hi @Sukumarsawant, I've opened a PR implementing the missing hyperbolic math functions acosh, asinh, atanh, cosh, sinh, and tanh along with fixing the missing math.yaml entries for acospif and atan2f16. Could you please review it when you get a chance? Thank you!

PR: 199442

iamaayushrivastava avatar May 24 '26 19:05 iamaayushrivastava

Hi @Sukumarsawant, I've opened a PR implementing the missing hyperbolic math functions acosh, asinh, atanh, cosh, sinh, and tanh along with fixing the missing math.yaml entries for acospif and atan2f16. Could you please review it when you get a chance? Thank you!

PR: 199442

Some haven't been implemented yet, do check the comment on your PR .Have updated the description accordingly.

Sukumarsawant avatar May 24 '26 20:05 Sukumarsawant

@Sukumarsawant is asinbf16 and atanbf16 good candidate to add ?

generic/asinbf16.cpp

Ko496-glitch avatar May 24 '26 20:05 Ko496-glitch

@Sukumarsawant is asinbf16 and atanbf16 good candidate to add ?

generic/asinbf16.cpp

Excluding bf16 functions*

Sukumarsawant avatar May 24 '26 20:05 Sukumarsawant

hypotf16 ?

Ko496-glitch avatar May 24 '26 20:05 Ko496-glitch

hypotf16

It's already there in math.yaml

Sukumarsawant avatar May 24 '26 20:05 Sukumarsawant

I was looking through the remaining entries related to this issue and would like to contribute.

Are there any missing functions in math.yaml that have not yet been claimed or covered by existing PRs? If so, I'd be happy to work on one of them.

AjaySingh8923 avatar May 31 '26 13:05 AjaySingh8923