It is surprising to me that eps(Complex{Float32})
is unsupported currently, given that there are many applications involving complex data where one would like to specify the precision of some operation appropriately.
A single line addition to Base will address this:
eps(::Type{Complex{T}}) where T <: AbstractFloat = eps(T)
I realize that the docs for eps
refer to “next largest value” and there is no ordering of complex numbers, but the principle applies adequately to the real and imaginary parts.
I can submit a PR to add this one line (and associated tests and docs) but I wanted to first get a sense of whether this addition seems appropriate to others.
BTW, in Matlab eps(1 + 1i)
works and returns the same value as eps(1)
so I think I’m not too far out on a limb here…
I’ve seen at least two package issues that arose due to this absence:
https://github.com/JuliaLang/julia/issues/34866
https://github.com/SciML/DifferentialEquations.jl/issues/287