You are here

public static function PHPExcel_Calculation_MathTrig::FLOOR in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php \PHPExcel_Calculation_MathTrig::FLOOR()

* FLOOR * * Rounds number down, toward zero, to the nearest multiple of significance. * * Excel Function: * FLOOR(number[,significance]) * * @access public * @category Mathematical and Trigonometric Functions *

Parameters

float $number Number to round: * @param float $significance Significance * @return float Rounded Number

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php, line 310

Class

PHPExcel_Calculation_MathTrig
PHPExcel_Calculation_MathTrig

Code

public static function FLOOR($number, $significance = NULL) {
  $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
  $significance = PHPExcel_Calculation_Functions::flattenSingleValue($significance);
  if (is_null($significance) && PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
    $significance = $number / abs($number);
  }
  if (is_numeric($number) && is_numeric($significance)) {
    if ($significance == 0.0) {
      return PHPExcel_Calculation_Functions::DIV0();
    }
    elseif ($number == 0.0) {
      return 0.0;
    }
    elseif (self::SIGN($number) == self::SIGN($significance)) {
      return floor($number / $significance) * $significance;
    }
    else {
      return PHPExcel_Calculation_Functions::NaN();
    }
  }
  else {
    return PHPExcel_Calculation_Functions::VALUE();
  }
}