Skip to content

Commit

Permalink
Merge pull request #8784 from JuliaLang/teh/expneg
Browse files Browse the repository at this point in the history
Raise informative error for exponentiation to negative power (see #3024)
  • Loading branch information
StefanKarpinski committed Oct 24, 2014
2 parents 1000471 + 79c9dfc commit 48dbe3a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/replutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ function showerror(io::IO, e::DomainError, bt)
print(io, "\n", code[1],
" will only return a complex result if called with a complex argument.",
"\ntry ", code[1], "(complex(x))")
elseif code[1] == :^ && code[2] == symbol("intfuncs.jl")
print(io, "\nCannot raise an integer x to a negative power -n. Make x a float by adding")
print(io, "\na zero decimal (e.g. 2.0^-n instead of 2^-n), or write 1/x^n, float(x)^-n, or (x//1)^-n")
end
break
end
Expand Down

0 comments on commit 48dbe3a

Please sign in to comment.