Bugfix: Work Item GH-302 - Fix for CEIL() and FLOOR() when number argument is zero

This commit is contained in:
MarkBaker 2014-12-06 17:44:27 +00:00
parent 741500da14
commit 4d67ff7de9
2 changed files with 6 additions and 6 deletions

View File

@ -146,7 +146,7 @@ class PHPExcel_Calculation_MathTrig {
} }
if ((is_numeric($number)) && (is_numeric($significance))) { if ((is_numeric($number)) && (is_numeric($significance))) {
if ($significance == 0.0) { if (($number == 0.0 ) || ($significance == 0.0)) {
return 0.0; return 0.0;
} elseif (self::SIGN($number) == self::SIGN($significance)) { } elseif (self::SIGN($number) == self::SIGN($significance)) {
return ceil($number / $significance) * $significance; return ceil($number / $significance) * $significance;
@ -316,10 +316,9 @@ class PHPExcel_Calculation_MathTrig {
} }
if ((is_numeric($number)) && (is_numeric($significance))) { if ((is_numeric($number)) && (is_numeric($significance))) {
if ((float) $significance == 0.0) { if (($number == 0.0 ) || ($significance == 0.0)) {
return PHPExcel_Calculation_Functions::DIV0(); return 0.0;
} } elseif (self::SIGN($number) == self::SIGN($significance)) {
if (self::SIGN($number) == self::SIGN($significance)) {
return floor($number / $significance) * $significance; return floor($number / $significance) * $significance;
} else { } else {
return PHPExcel_Calculation_Functions::NaN(); return PHPExcel_Calculation_Functions::NaN();

View File

@ -37,6 +37,7 @@ Planned for v1.8.1
- Bugfix: (frozenstupidity) Work Item GH-423 - Fix invalid NA return in VLOOKUP - Bugfix: (frozenstupidity) Work Item GH-423 - Fix invalid NA return in VLOOKUP
- Bugfix: (wiseloren) Work Item CP21454 - "No Impact" conditional formatting fix for NumberFormat - Bugfix: (wiseloren) Work Item CP21454 - "No Impact" conditional formatting fix for NumberFormat
- Bugfix: (bobwitlox) Work Item GH-467 - Bug in Excel2003XML reader, parsing merged cells - Bugfix: (bobwitlox) Work Item GH-467 - Bug in Excel2003XML reader, parsing merged cells
- Bugfix: (MBaker) Work Item GH-302 - Fix for CEIL() and FLOOR() when number argument is zero
- General: (MBaker) - Small performance improvement for autosize columns - General: (MBaker) - Small performance improvement for autosize columns
- General: (frost-nzcr4) Work Item GH-379 - Change the getter/setter for zeroHeight to camel case - General: (frost-nzcr4) Work Item GH-379 - Change the getter/setter for zeroHeight to camel case
- General: (MBaker) Work Item GH-394 - DefaultValueBinder is too much aggressive when converting string to numeric - General: (MBaker) Work Item GH-394 - DefaultValueBinder is too much aggressive when converting string to numeric