Skip to content

faster BigFloat(::Float64)#47546

Merged
oscardssmith merged 6 commits intomasterfrom
oscardssmith-faster-BigFloat(Float64)
Dec 1, 2022
Merged

faster BigFloat(::Float64)#47546
oscardssmith merged 6 commits intomasterfrom
oscardssmith-faster-BigFloat(Float64)

Conversation

@oscardssmith
Copy link
Copy Markdown
Member

This technically has different behavior than the current behavior but I'm pretty sure that no one was using BigFloat with precision<53 because the current behavior is to give you all 53 bits for precision>=40 and only the leading 8 bits for precision<40. This is roughly 2x faster for precision<10000. It's a little slower for precisions >10^6 (about 20%) but IMO this doesn't really matter since for high precision things like multiplication will be way slower than construction.

This technically has different behavior than the current behavior but I'm pretty sure that no one was using `BigFloat` with precision<53 because the current behavior is to give you all 53 bits for precision>=40 and only the leading 8 bits for precision<40. This is roughly 2x faster for precision<10000. It's a little slower for precisions >10^6 (about 20%) but IMO this doesn't really matter since for high precision things like multiplication will be way slower than construction.
@oscardssmith oscardssmith added performance Must go faster maths Mathematical functions labels Nov 12, 2022
@oscardssmith
Copy link
Copy Markdown
Member Author

The tests this is failing are tests of BigFloat(::Float64) with precision=4 which I'm not sure anyone is using, but is technically breaking.

@brenhinkeller brenhinkeller added the bignums BigInt and BigFloat label Nov 26, 2022
@oscardssmith
Copy link
Copy Markdown
Member Author

This is ready to merge and is a noticeable performance improvement if we don't mind the added complexity.

@StefanKarpinski
Copy link
Copy Markdown
Member

Yeah, why not. When has adding a little implementation complexity for the sake of speed stopped us?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bignums BigInt and BigFloat maths Mathematical functions performance Must go faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants