maths.signum ============ .. py:module:: maths.signum .. autoapi-nested-parse:: Signum function -- https://en.wikipedia.org/wiki/Sign_function Functions --------- .. autoapisummary:: maths.signum.signum maths.signum.test_signum Module Contents --------------- .. py:function:: signum(num: float) -> int Applies signum function on the number Custom test cases: >>> signum(-10) -1 >>> signum(10) 1 >>> signum(0) 0 >>> signum(-20.5) -1 >>> signum(20.5) 1 >>> signum(-1e-6) -1 >>> signum(1e-6) 1 >>> signum("Hello") Traceback (most recent call last): ... TypeError: '<' not supported between instances of 'str' and 'int' >>> signum([]) Traceback (most recent call last): ... TypeError: '<' not supported between instances of 'list' and 'int' .. py:function:: test_signum() -> None Tests the signum function >>> test_signum()