You are here

public static function PHPExcel_Calculation_Engineering::BESSELY in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php \PHPExcel_Calculation_Engineering::BESSELY()

* BESSELY * * Returns the Bessel function, which is also called the Weber function or the Neumann function. * * Excel Function: * BESSELY(x,ord) * * @access public * @category Engineering Functions *

Parameters

float $x The value at which to evaluate the function.: * If x is nonnumeric, BESSELK returns the #VALUE! error value. * @param integer $ord The order of the Bessel function. If n is not an integer, it is truncated. * If $ord is nonnumeric, BESSELK returns the #VALUE! error value. * If $ord < 0, BESSELK returns the #NUM! error value. * * @return float

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php, line 1017

Class

PHPExcel_Calculation_Engineering
PHPExcel_Calculation_Engineering

Code

public static function BESSELY($x, $ord) {
  $x = is_null($x) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($x);
  $ord = is_null($ord) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
  if (is_numeric($x) && is_numeric($ord)) {
    if ($ord < 0 || $x == 0.0) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    switch (floor($ord)) {
      case 0:
        return self::_Bessely0($x);
        break;
      case 1:
        return self::_Bessely1($x);
        break;
      default:
        $fTox = 2 / $x;
        $fBym = self::_Bessely0($x);
        $fBy = self::_Bessely1($x);
        for ($n = 1; $n < $ord; ++$n) {
          $fByp = $n * $fTox * $fBy - $fBym;
          $fBym = $fBy;
          $fBy = $fByp;
        }
    }
    return is_nan($fBy) ? PHPExcel_Calculation_Functions::NaN() : $fBy;
  }
  return PHPExcel_Calculation_Functions::VALUE();
}