Storage of -0.0 in sparse arrays

If I store -0.0 as array element of a SparseVector, it depends on the history of modifications, whether I retrieve -0.0 or 0.0:

julia> A = sparse([0.0;0.0])
2-element SparseVector{Float64,Int64} with 0 stored entries
julia> A[1] = -0.0; A[1]
0.0
julia> A[1] = 1; A[1] = -0.0; A[1]
-0.0

While it is clear to me, why this happens, it looks like inconsistent behaviour. When I store -0.0 I expect

  • either the negative sign is always preserved
  • or the -0.0 is always replaced by 0.0

Is that a bug or a feature? In the first case, we should change the implementation. In the second case, we should document it somehow.

Sparse matrix multiplication is not IEEE compliant; I suspect this is yet another manifestation of that. See https://github.com/JuliaLang/julia/issues/22733

It is related, for sure! But in a way it is not the heavy NaN / Inf case.
I do not want to make spare matrix multiplication IEEE754 compliant, but only achieve a reliable store-reload behaviour, without any arithmetic considerations.
From the remarks about -0.0 in the link, I assume, the second option (replace -0.0 by 0.0 during setindex!) would be preferred.