From discourse:
julia> using Colors, ColorVectorSpace, LinearAlgebra, FixedPointNumbers
julia> norm(RGB(0.008,0.008,0.008))
0.008
julia> norm(RGB{N0f8}(0.008,0.008,0.008)) # spurious underflow
0.0
We typically expect norm to avoid spurious underflow. It looks like you already do so for RGB{Float64}, since norm([RGB(1e-300, 1e-300, 1e-300)]) correctly returns ≈ 1e-300 rather than underflowing to zero.
I would suggest doing norm computation in the precision of the output (Float64) rather than in the precision of the input, as well as being careful about scaling.
From discourse:
We typically expect
normto avoid spurious underflow. It looks like you already do so forRGB{Float64}, sincenorm([RGB(1e-300, 1e-300, 1e-300)])correctly returns≈ 1e-300rather than underflowing to zero.I would suggest doing
normcomputation in the precision of the output (Float64) rather than in the precision of the input, as well as being careful about scaling.