<div dir="ltr"><div>Howdy,</div><div>I think that the SignedNumberType should implement a method called sign that will return -1 for negative numbers, 0 for 0 and 1 for positive numbers. This is similar to the signum method in e.g. Java and similarly called methods in other languages.</div><div><br></div><div>The implementation is fairly straight forward</div><div><br></div><div>extension SignedNumberType {</div><div>  var sign: Self {</div><div>    if self == 0 {</div><div>      return 0</div><div>    }</div><div>    else if self &gt; 0 {</div><div>      return 1</div><div>    }</div><div>    return -1</div><div>  }</div><div>} </div><div><br></div><div>I was trying to implement is without branching by doing (x &gt; 0) - (x &lt; 0) but I couldn&#39;t get the types right so I&#39;m open to suggestions.</div><div><br></div><div><br></div></div>