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

Consider "\%" operator in Calc to compute both the quotient and remainder #677

Open
rlwhitcomb opened this issue May 15, 2024 · 1 comment
Assignees

Comments

@rlwhitcomb
Copy link
Owner

The underlying methods in BigDecimal, etc. are already there, and it might save a bit of time and code to do both at once if needed (and they often are used together).

@rlwhitcomb rlwhitcomb self-assigned this May 15, 2024
@rlwhitcomb
Copy link
Owner Author

rlwhitcomb commented May 16, 2024

There is something VERY odd about our remainder / mod result with fractions.

Quotient / remainder should be x = yq + r when x ÷ y but since dividing fractions is just multiplication by the inverse, r will always be zero. If x == a/b and y == c/d, so a/b ÷ c/d = a×d / b×c so q = ad / bc and then yq is c/d × ad / bc or ca / bc or just a/b, in other words x. So r must always be 0 when dividing fractions.

I don't know where I got the "formula" for remainder inside BigFraction, but it seems to be bogus...

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

No branches or pull requests

1 participant