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

Integer powers are somewhat broken #40

Open
eschnett opened this issue Feb 17, 2024 · 0 comments
Open

Integer powers are somewhat broken #40

eschnett opened this issue Feb 17, 2024 · 0 comments

Comments

@eschnett
Copy link

I just saw this line

^(x::SimpleRatio, y::Integer) = SimpleRatio(x.num^y, x.den^y)
in the code.

This would handle only non-negative powers. For rational numbers I would expect negative powers to work as well.

It seems that the code is currently working because a different method is chosen for exponentiation. However, this fails:

julia> SimpleRatio(x)^Int8(-1)
ERROR: DomainError with -1:
Cannot raise an integer x to a negative power -1.
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

1 participant