FLOOR() function accept negative number and negative significance
Closes #1245
This commit is contained in:
parent
9fa45f7e48
commit
cc92c6648e
|
@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- ...
|
- FLOOR() function accept negative number and negative significance [#1245](https://github.com/PHPOffice/PhpSpreadsheet/pull/1245)
|
||||||
|
|
||||||
## [1.10.0] - 2019-11-18
|
## [1.10.0] - 2019-11-18
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,9 @@ class MathTrig
|
||||||
return Functions::DIV0();
|
return Functions::DIV0();
|
||||||
} elseif ($number == 0.0) {
|
} elseif ($number == 0.0) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
} elseif (self::SIGN($number) == self::SIGN($significance)) {
|
} elseif (self::SIGN($significance) == 1) {
|
||||||
|
return floor($number / $significance) * $significance;
|
||||||
|
} elseif (self::SIGN($number) == -1 && self::SIGN($significance) == -1) {
|
||||||
return floor($number / $significance) * $significance;
|
return floor($number / $significance) * $significance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ return [
|
||||||
-2,
|
-2,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'#NUM!',
|
-4,
|
||||||
-2.5,
|
-2.5,
|
||||||
2,
|
2,
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue