FLOOR() function accept negative number and negative significance

Closes #1245
This commit is contained in:
Ikko Ashimine 2019-11-17 14:12:39 +09:00 committed by Adrien Crivelli
parent 9fa45f7e48
commit cc92c6648e
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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;
} }

View File

@ -12,7 +12,7 @@ return [
-2, -2,
], ],
[ [
'#NUM!', -4,
-2.5, -2.5,
2, 2,
], ],