You are here

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

* MOD * *

Parameters

int $a Dividend: * @param int $b Divisor * @return int Remainder

File

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

Class

PHPExcel_Calculation_MathTrig
PHPExcel_Calculation_MathTrig

Code

public static function MOD($a = 1, $b = 1) {
  $a = PHPExcel_Calculation_Functions::flattenSingleValue($a);
  $b = PHPExcel_Calculation_Functions::flattenSingleValue($b);
  if ($b == 0.0) {
    return PHPExcel_Calculation_Functions::DIV0();
  }
  elseif ($a < 0.0 && $b > 0.0) {
    return $b - fmod(abs($a), $b);
  }
  elseif ($a > 0.0 && $b < 0.0) {
    return $b + fmod($a, abs($b));
  }
  return fmod($a, $b);
}