Math.sign vs ±0

Oliver Hunt oliver at
Tue Oct 29 20:54:11 PDT 2013

As currently specified Math.sign has 5 different return values and, as far as i can tell, does not solve the problem I thought it was trying to address. That is the difficulty in distinguishing positive and negative numbers without having to manually do the divide -> ±Infinity cruft.

What is the rational for this behaviour?

Current Math.sign is a new, and unexpectedly complex API that doesn’t solve the common use case.


More information about the es-discuss mailing list