-
Notifications
You must be signed in to change notification settings - Fork 112
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
conversion of big int to string #617
Comments
@afabri : Could you post a reproducer? Sounds like a bug that needs fixed instead of something that needs a workaround. |
Indeed, plus is there any particular reason not to just call the |
I have put a self contained program here on gist.github.com. Calling |
Under vtune I can see that it is the |
Ah performance, not value of result, I misunderstood, apologies. Yes we know that cpp_int division is terribly slow compared to GMP, but GMP is a tour-de-force of optimisation and we're not really trying to compete on that front (which is not to say we couldn't do better). |
In our use case (a multiprecision float with mantissa and exponent being arbitrary precision ints) we are only interested in the leading N characters of the string representing the number. |
Cound you do something a bit non-elegant like get the MSB (for |
@jzmaddock Can you give me a pointer to a publication that tells what has to be implemented to catch up? |
I'll put out a few details.
@jzmaddock might add more. P.S. I like the algorithm descriptions in: [1] R. Brent and P. Zimmermann, "Modern Computer Arithmetic", Cambridge University Press, 2011. |
We use
i.convert_to<std::string>
for a multi precision integeri
and observe a factor of 10 difference for thecpp_int
backend compared to thegmp_int
backend. Is there a better way than usingconvert_to()
?The text was updated successfully, but these errors were encountered: