You are here

public static function PHPExcel_Calculation_MathTrig::ODD 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::ODD()

* ODD * * Returns number rounded up to the nearest odd integer. * *

Parameters

float $number Number to round: * @return int Rounded Number

File

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

Class

PHPExcel_Calculation_MathTrig
PHPExcel_Calculation_MathTrig

Code

public static function ODD($number) {
  $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
  if (is_null($number)) {
    return 1;
  }
  elseif (is_bool($number)) {
    $number = (int) $number;
  }
  if (is_numeric($number)) {
    $significance = self::SIGN($number);
    if ($significance == 0) {
      return 1;
    }
    $result = self::CEILING($number, $significance);
    if ($result == self::EVEN($result)) {
      $result += $significance;
    }
    return (int) $result;
  }
  return PHPExcel_Calculation_Functions::VALUE();
}