Skip to content

Conversation

@shardator
Copy link

@shardator shardator commented Mar 9, 2021

Fix for the bigint issue: Removed any floating point calculations, using an improved integer sqrt algorithm from https://stackoverflow.com/a/31224469/8637159

@shardator
Copy link
Author

Links to #2

@n1ngu
Copy link

n1ngu commented Apr 16, 2021

Removing float point calculations is the way to go. But the isqrt implementation shouldn't be responsibility of this package.

As of 2021 the way to go is simply require python>3.8 and use https://docs.python.org/3.8/library/math.html#math.isqrt

For other versions, the gmpy2 library could be required and the isqrt function could be conditionally imported from the correct place:

try:
  from gmpy2 import isqrt
except ImportError:
  from math import isqrt
except ImportError:
  from math import sqrt
  def isqrt(x):
    return int(sqrt(x))

and maybe raise warnings about upgrading your python installations or collecting adequate extra packages unless an underperformant depairing function is acceptable.

At the end, all this is a packaging issue. And I fear this package is rather immature in this regard 😢 . Yet, it shouldn't be hard. I could work it out if the owner is willing to give this package some live.

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.

2 participants