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

[HELP] Why does libm not have nextafter? #13065

Closed
1 task done
sastel opened this issue Aug 20, 2024 · 3 comments
Closed
1 task done

[HELP] Why does libm not have nextafter? #13065

sastel opened this issue Aug 20, 2024 · 3 comments
Labels
Community: Question Further information is requested

Comments

@sastel
Copy link

sastel commented Aug 20, 2024

Description

I'm working on getting gtest executables to compile for kernel mode, so that I can run my tests on the target hardware. The EXPECT_NEAR tests in gtest rely on nextafter(). So my tests fail to link, because libm doesn't have a definition for nextafter().

Does anyone know why this function was not included in libm? I can add it myself, but I'm wondering if there is a fundamental reason that I need to be aware of for why it isn't already present.

Using libmcs isn't an option for me, because RISC-V RV64 uses 128 bit long double, and libmcs only supports 64 bit long double in order to comply with IEEE-754. I tried newlib, but the cmath header fails to compile due to references to the undeclared long double versions of the math functions, which is the same symptom I get when I compile libmcs without long double.

Verification

  • I have verified before submitting the report.
@sastel sastel added the Community: Question Further information is requested label Aug 20, 2024
@acassis
Copy link
Contributor

acassis commented Aug 20, 2024

Hi @sastel I think it is not included because nobody used it until now. Also ANSI C doesn't require this function: https://docs.rtems.org/releases/4.5.1-pre3/toolsdoc/newlib-1.8.2-docs/libm/libm00036.html

@sastel
Copy link
Author

sastel commented Aug 20, 2024

Thanks @acassis .

@sastel sastel closed this as completed Aug 20, 2024
@acassis
Copy link
Contributor

acassis commented Aug 20, 2024

@sastel if you submit an implementation, please link to this Issue here for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community: Question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants