Skip to content

ellipk(NaN) throws UndefVarError #498

@ogauthe

Description

@ogauthe

Hi! I found ellipk crashes when input is NaN.

julia> ellipk(NaN)
ERROR: UndefVarError: `x` not defined in local scope
Suggestion: check for an assignment to a local variable that shadows a global of the same name.
Stacktrace:
 [1] _ellipk(m::Float64)
   @ SpecialFunctions ~/.julia/packages/SpecialFunctions/mf0qH/src/ellip.jl:57
 [2] ellipk(m::Float64)
   @ SpecialFunctions ~/.julia/packages/SpecialFunctions/mf0qH/src/ellip.jl:45
 [3] top-level scope
   @ REPL[14]:1

I guess it should either return NaN or throw a DomainError.

There is also an issue with -Inf.

julia> ellipk(-Inf)
ERROR: UndefVarError: `t` not defined in local scope
Suggestion: check for an assignment to a local variable that shadows a global of the same name.
Stacktrace:
 [1] _ellipk(m::Float64)
   @ SpecialFunctions ~/.julia/packages/SpecialFunctions/mf0qH/src/ellip.jl:0
 [2] ellipk(m::Float64)
   @ SpecialFunctions ~/.julia/packages/SpecialFunctions/mf0qH/src/ellip.jl:45
 [3] top-level scope
   @ REPL[12]:1

I think it should return 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions