JuliaMath / NaNMath.jl

Julia math built-ins which return NaN and accumulator functions which ignore NaN
Other
53 stars 28 forks source link

NaNMath functions should fallback to the default method #66

Open YingboMa opened 1 year ago

YingboMa commented 1 year ago
julia> asin(1+1im)
0.6662394324925153 + 1.0612750619050357im

julia> using NaNMath

julia> NaNMath.asin(1+1im)
ERROR: MethodError: no method matching asin(::Complex{Int64})
You may have intended to import Base.asin

Closest candidates are:
  asin(::DualNumbers.Dual)
   @ DualNumbers ~/.julia/packages/DualNumbers/5knFX/src/dual.jl:327
  asin(::PolyForm{<:Number})
   @ SymbolicUtils ~/src/julia/SymbolicUtils/src/methods.jl:87
  asin(::SymbolicUtils.BasicSymbolic{<:Number})
   @ SymbolicUtils ~/src/julia/SymbolicUtils/src/methods.jl:87
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[7]:1
kapple19 commented 2 months ago

IntervalArithmetic would benefit from this too. I was just about to submit a pull request for a NaNMath extension in IntervalArithmetic, then realised it would be more effective if NaNMath fellback to Base functions for other numeric types inputted. Is there any work on this? I'm happy to pick this up.