Skip to content

the error message for ^ calls all unknown types "integer" #55960

Open
@nsajko

Description

julia> π^Int(-1)
ERROR: DomainError with -1:
Cannot raise an integer x to a negative power -1.
Convert input to float.
Stacktrace:
 [1] throw_domerr_powbysq(::Float64, p::Int64)
   @ Base ./intfuncs.jl:302
 [2] power_by_squaring(x_::Irrational{:π}, p::Int64; mul::typeof(*))
   @ Base ./intfuncs.jl:327
 [3] power_by_squaring
   @ ./intfuncs.jl:316 [inlined]
 [4] ^(x::Irrational{:π}, p::Int64)
   @ Base ./intfuncs.jl:352
 [5] top-level scope
   @ REPL[1]:1

julia> isinteger(π)
false

NB: there's nothing special about π here, all unknown (not-floating-point?) types seem to be regarded as integer by the error message.

Metadata

Assignees

No one assigned

    Labels

    error messagesBetter, more actionable error messagesmathsMathematical functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions