Why does Mathf.Sign(0.0f) return 1?

According to this wikipedia article it should return 0 if x == 0. Unity3D however returns 1 if x == 0.

Now I’m not sure if I’m blaming Unity3D correctly, maybe I misinterpreted the article. But is there a Math function which does work like Mathf.Sign() only returns 0 when x == 0?

For example I want this:

Mathf.Sign(0.1f) == 1;
Mathf.Sign(10.6f) == 1;
Mathf.Sign(-0.2f) == -1;
Mathf.Sign(0.0f) == 0;

Because 0 is considered a positive number by Unity it returns 1 you will have to test for 0 explicitly or write your own function.

 static function Sign(number : float) {
     return number < 0 ? -1 : (number > 0 ? 1 : 0);
 }

You should use Math.Sign() instead of Mathf.Sign().

Mathf is Unity’s library, returns only -1 and 1… just as written in documentation:
Unity - Scripting API: Mathf.Sign

Math is c# 's library, and works “correctly” (same as mathematical signum function), returns -1,0,1.