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

Rational Limitations #91

Open
ghost opened this issue Oct 30, 2016 · 2 comments
Open

Rational Limitations #91

ghost opened this issue Oct 30, 2016 · 2 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Oct 30, 2016

Version: 1.0.0

Problem

Rationals don't support very big/very small numbers and sometimes produce incorrect result

Desired Behavior

Work correctly ._.

How to Reproduce

  1. Do Rational.of(0.00005)
  2. It print 0 / 1
  3. Do Rational.of(1000000000000)
  4. It print -727379968 / 1 (Probably integer size issue, but ._.)
@vihanb vihanb added the bug label Oct 30, 2016
@vihanb vihanb changed the title Rationals are bad Rational Limitations Oct 30, 2016
@LegionMammal978
Copy link
Collaborator

Rational.of(0.00005)

Rational.of (and indeed, all implicit conversion to Rational) from a decimal has a maximum denominator of 1000 due to floating-point precision issues. I'll see if I can do anything about these cases.

Rational.of(1000000000000)

See:

> 1000000000000|0
-727379968

Numerators and denominators in Rational can only be exact numbers.

@vihanb
Copy link
Member

vihanb commented Nov 27, 2016

@LegionMammal978 btw, could you add support for a cheddar constructor/casting. so Rational { 0.5 }, Rational { 1, 2 }, Rational::0.5 can all work?

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

No branches or pull requests

2 participants