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

Add rounding operations to Data.Rational #1063

Closed
gallais opened this issue Jan 21, 2020 · 2 comments · Fixed by #1585
Closed

Add rounding operations to Data.Rational #1063

gallais opened this issue Jan 21, 2020 · 2 comments · Fixed by #1585

Comments

@gallais
Copy link
Member

gallais commented Jan 21, 2020

This interesting article suggests useful operations we may want to have on rational numbers:

round floor ceiling truncate : ℤ × ℚ

together with the proofs of their properties, of course.

@MatthewDaggitt
Copy link
Contributor

Hmm I'd be tempted to have the standard signature ℚ → ℤ for those operations then have another operator frac : ℚ →ℚ that returns the fractional part. Presumably they're simply going to be implemented by the _/_ and _%_ operators respectively so it's not like they have any computational overlap.

@barrettj12
Copy link
Contributor

I've just opened a PR #1585 which implements the suggested functions. I have not been able to prove any properties about said functions. Should we open a new issue for the implementation of those properties?

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

Successfully merging a pull request may close this issue.

3 participants