当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Calculation_Functions::DIV0方法代码示例

本文整理汇总了PHP中PHPExcel_Calculation_Functions::DIV0方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Calculation_Functions::DIV0方法的具体用法?PHP PHPExcel_Calculation_Functions::DIV0怎么用?PHP PHPExcel_Calculation_Functions::DIV0使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPExcel_Calculation_Functions的用法示例。


在下文中一共展示了PHPExcel_Calculation_Functions::DIV0方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DOLLARFR

 /**
  * DOLLARFR
  *
  * Converts a dollar price expressed as a decimal number into a dollar price
  *		expressed as a fraction.
  * Fractional dollar numbers are sometimes used for security prices.
  *
  * Excel Function:
  *		DOLLARFR(decimal_dollar,fraction)
  *
  * @access	public
  * @category Financial Functions
  * @param	float	$decimal_dollar		Decimal Dollar
  * @param	integer	$fraction			Fraction
  * @return	float
  */
 public static function DOLLARFR($decimal_dollar = Null, $fraction = 0)
 {
     $decimal_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($decimal_dollar);
     $fraction = (int) PHPExcel_Calculation_Functions::flattenSingleValue($fraction);
     // Validate parameters
     if (is_null($decimal_dollar) || $fraction < 0) {
         return PHPExcel_Calculation_Functions::NaN();
     }
     if ($fraction == 0) {
         return PHPExcel_Calculation_Functions::DIV0();
     }
     $dollars = floor($decimal_dollar);
     $cents = fmod($decimal_dollar, 1);
     $cents *= $fraction;
     $cents *= pow(10, -ceil(log10($fraction)));
     return $dollars + $cents;
 }
开发者ID:arjunkumar786,项目名称:faces,代码行数:33,代码来源:Financial.php

示例2: VARPA

 /**
  *	VARPA
  *
  *	Calculates variance based on the entire population, including numbers, text, and logical values
  *
  *	Excel Function:
  *		VARPA(value1[,value2[, ...]])
  *
  *	@access	public
  *	@category Statistical Functions
  *	@param	mixed		$arg,...		Data values
  *	@return	float
  */
 public static function VARPA()
 {
     // Return value
     $returnValue = PHPExcel_Calculation_Functions::DIV0();
     $summerA = $summerB = 0;
     // Loop through arguments
     $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
     $aCount = 0;
     foreach ($aArgs as $k => $arg) {
         if (is_string($arg) && PHPExcel_Calculation_Functions::isValue($k)) {
             return PHPExcel_Calculation_Functions::VALUE();
         } elseif (is_string($arg) && !PHPExcel_Calculation_Functions::isMatrixValue($k)) {
         } else {
             // Is it a numeric value?
             if (is_numeric($arg) || is_bool($arg) || is_string($arg) & $arg != '') {
                 if (is_bool($arg)) {
                     $arg = (int) $arg;
                 } elseif (is_string($arg)) {
                     $arg = 0;
                 }
                 $summerA += $arg * $arg;
                 $summerB += $arg;
                 ++$aCount;
             }
         }
     }
     // Return
     if ($aCount > 0) {
         $summerA *= $aCount;
         $summerB *= $summerB;
         $returnValue = ($summerA - $summerB) / ($aCount * $aCount);
     }
     return $returnValue;
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:47,代码来源:Statistical.php

示例3: POWER

 /**
  * POWER
  *
  * Computes x raised to the power y.
  *
  * @param	float		$x
  * @param	float		$y
  * @return	float
  */
 public static function POWER($x = 0, $y = 2)
 {
     $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
     $y = PHPExcel_Calculation_Functions::flattenSingleValue($y);
     // Validate parameters
     if ($x == 0.0 && $y == 0.0) {
         return PHPExcel_Calculation_Functions::NaN();
     } elseif ($x == 0.0 && $y < 0.0) {
         return PHPExcel_Calculation_Functions::DIV0();
     }
     // Return
     $result = pow($x, $y);
     return !is_nan($result) && !is_infinite($result) ? $result : PHPExcel_Calculation_Functions::NaN();
 }
开发者ID:Princelo,项目名称:bioerp,代码行数:23,代码来源:MathTrig.php

示例4: testDIV0

 public function testDIV0()
 {
     $result = PHPExcel_Calculation_Functions::DIV0();
     $this->assertEquals('#DIV/0!', $result);
 }
开发者ID:MyPHPTools,项目名称:PHPExcel,代码行数:5,代码来源:FunctionsTest.php

示例5: POWER

 /**
  *	POWER
  *
  *	Computes x raised to the power y.
  *
  *	@param	float		$x
  *	@param	float		$y
  *	@return	float
  */
 public static function POWER($x = 0, $y = 2)
 {
     $x = PHPExcel_Calculation_Functions::flattenSingleValue($x);
     $y = PHPExcel_Calculation_Functions::flattenSingleValue($y);
     // Validate parameters
     if ($x == 0 && $y <= 0) {
         return PHPExcel_Calculation_Functions::DIV0();
     }
     // Return
     return pow($x, $y);
 }
开发者ID:Kiranj1992,项目名称:PHPExcel,代码行数:20,代码来源:MathTrig.php


注:本文中的PHPExcel_Calculation_Functions::DIV0方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。