To calculate that correctly, initialize x and y as BigFloats using strings.
julia> x = BigFloat("3e-200"); y = BigFloat("4e-200");
julia> sqrt(x^2 + y^2)
4.99999999999999999999999999999999999999999999999999999999999999999999999997e-200
otherwise the erosion has already occured when the conversion to BigFloat happens
1 Like
Yes, I was responding to “All it would require is doing the accumulation (not the squaring) in twice precision.” If efficiency is the concern, better to use the n-d generalization of the hypot algorithm |x| \sqrt{1 +(y/x)^2} in the original precision, where x is the largest element of the vector being summed.
3 Likes