You are here

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

* LOG_BASE * * Returns the logarithm of a number to a specified base. The default base is 10. * * Excel Function: * LOG(number[,base]) * * @access public * @category Mathematical and Trigonometric Functions *

Parameters

float $number The positive real number for which you want the logarithm: * @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10. * @return float

File

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

Class

PHPExcel_Calculation_MathTrig
PHPExcel_Calculation_MathTrig

Code

public static function LOG_BASE($number = NULL, $base = 10) {
  $number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
  $base = is_null($base) ? 10 : (double) PHPExcel_Calculation_Functions::flattenSingleValue($base);
  if (!is_numeric($base) || !is_numeric($number)) {
    return PHPExcel_Calculation_Functions::VALUE();
  }
  if ($base <= 0 || $number <= 0) {
    return PHPExcel_Calculation_Functions::NaN();
  }
  return log($number, $base);
}