public static function Calculator::floor in Price 8
Same name and namespace in other branches
- 3.x src/Calculator.php \Drupal\price\Calculator::floor()
- 2.0.x src/Calculator.php \Drupal\price\Calculator::floor()
- 2.x src/Calculator.php \Drupal\price\Calculator::floor()
- 3.0.x src/Calculator.php \Drupal\price\Calculator::floor()
Calculates the next lowest whole value of a number.
Parameters
string $number: The number.
Return value
string The result.
File
- src/
Calculator.php, line 128
Class
- Calculator
- Provides helpers for bcmath-based arithmetic.
Namespace
Drupal\priceCode
public static function floor($number) {
if (self::compare($number, 0) == 1) {
$result = bcadd($number, '0', 0);
}
else {
$result = bcadd($number, '-1', 0);
}
return $result;
}