function CtoolsMathExpressionTestCase::sign
Return the sign of the numeric arg $n as an integer -1, 0, 1.
Note: Not defined when $n is Infinity or NaN (or NULL or ...)!
Parameters
int|float $n: The number to test.
Return value
int -1 if the $n is negative, 0 if $n is zero or 1 if $n is positive.
See also
gmp_sign()
1 call to CtoolsMathExpressionTestCase::sign()
- CtoolsMathExpressionTestCase::assertFloat in tests/
math_expression.test - A custom assertion with checks the values in a certain range.
File
-
tests/
math_expression.test, line 42
Class
- CtoolsMathExpressionTestCase
- Tests the MathExpression library of ctools.
Code
protected static function sign($n) {
return ($n > 0) - ($n < 0);
}