How can I find out if a Float
value is a negative zero (and not a positive one)?
Unfortunately:
-0.0 == 0.0 # => true
-0.0 === 0.0 # => true
My initial solution works but is ugly:
x.to_s == '-0.0'
From this question, I found
x == 0 and 1 / x < 0
Is there a better, more Ruby-like way?