Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absent functions in math library #1055

Open
alvoskov opened this issue Nov 12, 2024 · 4 comments
Open

Absent functions in math library #1055

alvoskov opened this issue Nov 12, 2024 · 4 comments

Comments

@alvoskov
Copy link

The mathematical library doesn't contain such functions as erf or lgamma (they are required by C99 standard). E.g. such program doesn't compile. The functions prototypes are present in the header files but are not implemented.

#include "stdio.h"
#include "math.h"

int main()
{
    printf("%g\n", exp(1.0));
    printf("%g\n", exp(lgamma(4.0)));
} 

occ /9 a.c

Error: Undefined External 'lgamma' in module a.c

@LADSoft
Copy link
Owner

LADSoft commented Nov 26, 2024

yeah i was lazy about lgamma.... the last math implementation I got didn't have it and I never looked for a replacement. Will see what I can do....

LADSoft added a commit that referenced this issue Nov 27, 2024
LADSoft added a commit that referenced this issue Nov 27, 2024
@chuggafan
Copy link
Contributor

So, I've made my 2fa stuff using some TOTP tools.
Anyways:
There's plenty of functions that aren't implemented atm, e.g. the aforementioned erf (Oh hey, someone's implementation based off of a big book of these tables! https://www.johndcook.com/cpp_erf.html )
C23 has a few of these as well, e.g. the <trigfunc>pi functions, which is mildly different in implementation (if we want the highest accuracy) from the regular <trigfunc>.
This is probably going to be really annoying to implement all of these mathematical functions, but we should do it anyways.

@LADSoft
Copy link
Owner

LADSoft commented Dec 13, 2024

glad you are back on 😄

So probably the best thing to do is pull the function from llvm/libc implementation (which is here on github).... probably take a little bit of refactoring though....

@chuggafan
Copy link
Contributor

chuggafan commented Dec 14, 2024

I've taken a quick gander over at the llvm libc area.... it would require a lot of refactoring I believe...
I also don't believe they have the <something>pi functions, which glibc has.
Glibc DOES seem to be implementing those <something>pi functions in a straightforward way however, and we could do the same thing, we just need to identify what we're missing in order to fill in everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants