Skip to content

Comments

Fix dom_power issue on 32bit machine#197

Merged
ClementPernet merged 1 commit intomasterfrom
fix-dom_power_32bits
Dec 16, 2021
Merged

Fix dom_power issue on 32bit machine#197
ClementPernet merged 1 commit intomasterfrom
fix-dom_power_32bits

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