AbstractNumbers.jl
AbstractNumbers.jl copied to clipboard
Define your own number types in Julia super easily!
Having it in the Readme makes us think it's relevant to the package user (even if the section is titled "Implementation"), and reading it made me uncertain about whether this...
`using Base.Test` failed with ERROR: UndefVarError: `Test` not defined And `number` is enough and needed, otherwise: ERROR: AbstractNumbers.number not implemented This would fix #8
``` 1 ambiguities found Ambiguity #1 polygamma(a::Number, b::AbstractNumbers.AbstractNumber) in AbstractNumbers at /home/pkgeval/.julia/packages/AbstractNumbers/ONC07/src/overloads.jl:1251 polygamma(m::Integer, z::Number) in SpecialFunctions at /home/pkgeval/.julia/packages/SpecialFunctions/LC8dm/src/gamma.jl:562 ``` Seems like a real ambiguity, or?
``` julia> using AbstractNumbers, SpecialFunctions julia> struct MyNumber{T} Base.convert(::Type{Number}, x::MyNumber) = x.number julia> AbstractNumbers.basetype(::Type{ a=MyNumber(1.2) MyNumber{Float64}(1.2) julia> sin(a) ERROR: AbstractNumbers.number not implemented for MyNumber{Float64} Stacktrace: [1] error(::String) at .\error.jl:33 [2]...