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

Fast-path for rounding Real #1124

Open
armanbilge opened this issue Dec 10, 2021 · 1 comment
Open

Fast-path for rounding Real #1124

armanbilge opened this issue Dec 10, 2021 · 1 comment

Comments

@armanbilge
Copy link
Member

Real.roundUp(Rational(value, SafeLong(2).pow(bits - p)))

Pointed out by @s5bug on Discord.

hmm why does it do this instead of a bitshift?
I assume it's something like 0b1.01 should round to 0b1.1, but you can just check a bit for that
instead of having to do a whole GCD

@s5bug
Copy link

s5bug commented Dec 10, 2021

I'm also guessing that a bitshift can be done in any place where a rational with a power-of-two denominator is used. Such as the division by four in addition.

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

No branches or pull requests

2 participants