how to avoid "-0" when converting float to string?
when I convert floats to string like in this example, often I get "-0" as a value. Does anyone know a simple way to convert these to positive zero?
this is for serialization purposes, so I'd like to avoid some heavy checks just to avoid -0
3 Replies
Math.Abs maybe?
i could just check
==0
but that's some special branching just for a single value so I'm wondering if there's something more gracefulwhy is there a _Serialize method?
but yeah id just check if -0
but according IEEblabla -0 and 0 arent the same thing