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

Fix dom_power issue on 32bit machine #197

Merged
merged 1 commit into from
Dec 16, 2021
Merged

Conversation

cyrilbouvier
Copy link
Member

@cyrilbouvier cyrilbouvier commented Dec 16, 2021

dom_power is used to compute n^l. In the code of master l is taken as an long.
This causes some issues on 32 bits machine (see for exemple linbox-team/linbox#293).

In this PR, I propose to switch the type from long to uint64_t.

First, I think an unsigned type should be used: in the code of dom_power, the argument l is immediatly cast to an unsigned long and the bit representation of this value is used to perform a double and add algorithm. It means that calling dom_power with a negative l is incorrect (except in the case where order(n) = ULONG_MAX+1).

Second, I think that using a type with a fixed size is clearer: just looking at the prototype of the function tells you the maximum possible value of the exponent.

This PR fixes linbox-team/linbox#293

@ClementPernet
Copy link
Member

LGTM.

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

Successfully merging this pull request may close these issues.

Test FFT with ModularExtended<double> failing on i386
2 participants