You are here

public static function PHPExcel_Calculation_MathTrig::CEILING in Loft Data Grids 7.2

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

* CEILING * * Returns number rounded up, away from zero, to the nearest multiple of significance. * For example, if you want to avoid using pennies in your prices and your product is * priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the * nearest nickel. * * Excel Function: * CEILING(number[,significance]) * * @access public * @category Mathematical and Trigonometric Functions *

Parameters

float $number The number you want to round.: * @param float $significance The multiple to which you want to round. * @return float Rounded Number

2 calls to PHPExcel_Calculation_MathTrig::CEILING()
PHPExcel_Calculation_MathTrig::EVEN in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php
* EVEN * * Returns number rounded up to the nearest even integer. * You can use this function for processing items that come in twos. For example, * a packing crate accepts rows of one or two items. The crate is full when * the number of…
PHPExcel_Calculation_MathTrig::ODD in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php
* ODD * * Returns number rounded up to the nearest odd integer. * *

File

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

Class

PHPExcel_Calculation_MathTrig
PHPExcel_Calculation_MathTrig

Code

public static function CEILING($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 ($number == 0.0 || $significance == 0.0) {
      return 0.0;
    }
    elseif (self::SIGN($number) == self::SIGN($significance)) {
      return ceil($number / $significance) * $significance;
    }
    else {
      return PHPExcel_Calculation_Functions::NaN();
    }
  }
  return PHPExcel_Calculation_Functions::VALUE();
}