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

2^-5 isn't an error #44

Open
non-Jedi opened this issue Feb 23, 2019 · 2 comments
Open

2^-5 isn't an error #44

non-Jedi opened this issue Feb 23, 2019 · 2 comments

Comments

@non-Jedi
Copy link

WhyJulia states this gives an error, bt within the page it shows a regular Float64 result.

@ChrisRackauckas
Copy link
Member

Yeah, anyone have an example that isn't fixed by literal and constant propogation? It's hard to write a simple example now that fails because that tends to auto-fix them lol.

@rsokl
Copy link

rsokl commented Oct 10, 2019

I think that this would suffice:

julia> x = -5; 2 ^ x
ERROR: DomainError with -5:
Cannot raise an integer x to a negative power -5.
Make x or -5 a float by adding a zero decimal (e.g., 2.0^-5 or 2^-5.0 instead of 2^-5), or write 1/x^5, float(x)^-5, x^float(-5) or (x//1)^-5

Although it does lead to the unfortunate added burden of explaining why this is different than 2^(-5).

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

3 participants