From Daniel Lemire’s recent-ish blog post on this topic:
The ubiquitous IEEE floating-point standard defines two numbers to represent zero, the positive and the negative zeros. You also have the positive and negative infinity. If you compute the inverse of the positive zero, you get the positive infinity. If you compute the inverse of the negative zero, you get the negative infinity.
I wanted to check this out for the most frequent languages I tend to use—Ruby and JavaScript.
First up, Ruby:
Output: -Infinity, Infinity, -Infinity
Next, JavaScript:
Output: -Infinity, Infinity, -Infinity
Both languages (Ruby v. 2.7.1, JavaScript(NodeJS) v. 12.14.x & Chrome 91.x) return the values as expected in the post.