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

fmod error #1229

Open
adamdebek opened this issue Nov 12, 2024 · 0 comments
Open

fmod error #1229

adamdebek opened this issue Nov 12, 2024 · 0 comments
Labels
bug Something isn't working libphoenix

Comments

@adamdebek
Copy link
Contributor

Reproduction:

#include <stdio.h>
#include <math.h>
#include <errno.h>

int main(void) {
	errno = 0;
	printf("fmod: %g\n",  fmod(3.43028e+248, 5.81768e+215));
	printf("errno: %d\n", errno);

	errno = 0;
	printf("fmod: %g\n",  fmod(-1.97016e+208, 1.19546e+183));
	printf("errno: %d\n", errno);

	errno = 0;
	printf("fmod: %g\n",  fmod(1.43018e+205, 1.19546e+183));
	printf("errno: %d\n", errno);

	errno = 0;
	printf("fmod: %g\n",  fmod(7.29983e+204, 1.19546e+183));
	printf("errno: %d\n", errno);

	errno = 0;
	printf("fmod: %g\n",  fmod(9.41698e+181, 1.54897e+164));
	printf("errno: %d\n", errno);

	return 0;
}

for each of above pair of arguments, fmod return not valid reminder (greater than passed in second argument)
Its probably due to floating point numbers rounding, implementation do not take it into accout.

@adamdebek adamdebek added bug Something isn't working libphoenix labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libphoenix
Projects
None yet
Development

No branches or pull requests

1 participant