I was wondering if someone could explain what is going in with the below code to me:
function f3264() v32 = rand(Float32, 3) @info v32 v64 = Float64.(v32) @info v64 Δv = v64 .- v32 @info Δv @assert sum(Δv)==0 end f3264()
[ Info: Float32[0.674268, 0.45975626, 0.8845744] [ Info: [0.6742680072784424, 0.4597562551498413, 0.8845744132995605] [ Info: [0.0, 0.0, 0.0]
I’m not sure what to make of the extra digits present in the Float64 presentation (e.g. why isn’t the first Float64 value 0.6742680000000000.) The subtraction gives zero, but I’m not sure why- is this undefined behavior?