public static function Calculator::subtract in Physical Fields 8
Subtracts the second number from the first number.
Parameters
string $first_number: The first number.
string $second_number: The second number.
int $scale: The maximum number of digits after the decimal place. Any digit after $scale will be truncated.
Return value
string The result.
2 calls to Calculator::subtract()
- Measurement::subtract in src/
Measurement.php - Subtracts the given measurement from the current one.
- Temperature::convert in src/
Temperature.php - Converts the current temperature measurement to a new unit.
File
- src/
Calculator.php, line 53
Class
- Calculator
- Provides helpers for bcmath-based arithmetic.
Namespace
Drupal\physicalCode
public static function subtract($first_number, $second_number, $scale = 16) {
self::assertNumberFormat($first_number);
self::assertNumberFormat($second_number);
$result = bcsub($first_number, $second_number, $scale);
return self::trim($result);
}