function Calculator::neg
Negates a number.
6 calls to Calculator::neg()
- Calculator::bitwise in vendor/
brick/ math/ src/ Internal/ Calculator.php - Performs a bitwise operation on a decimal number.
- NativeCalculator::add in vendor/
brick/ math/ src/ Internal/ Calculator/ NativeCalculator.php - Adds two numbers.
- NativeCalculator::divQR in vendor/
brick/ math/ src/ Internal/ Calculator/ NativeCalculator.php - Returns the quotient and remainder of the division of two numbers.
- NativeCalculator::doSub in vendor/
brick/ math/ src/ Internal/ Calculator/ NativeCalculator.php - Performs the subtraction of two non-signed large integers.
- NativeCalculator::mul in vendor/
brick/ math/ src/ Internal/ Calculator/ NativeCalculator.php - Multiplies two numbers.
File
-
vendor/
brick/ math/ src/ Internal/ Calculator.php, line 115
Class
- Calculator
- Performs basic operations on arbitrary size integers.
Namespace
Brick\Math\InternalCode
public final function neg(string $n) : string {
if ($n === '0') {
return '0';
}
if ($n[0] === '-') {
return \substr($n, 1);
}
return '-' . $n;
}