Adding float cast to MOD function

If $a or $b are not strings, you can get an error that fmod needs param 1 ($a) to be of type double.
MS Excel does not fall over when you insert an empty string in MOD, so I'm guessing PHPExcel should do the same?
This commit is contained in:
Matthias Van Woensel 2016-12-04 16:11:22 +09:00 committed by Adrien Crivelli
parent 48a6e86adc
commit 39b8dbd0a1
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
2 changed files with 7 additions and 2 deletions

View File

@ -673,8 +673,8 @@ class MathTrig
*/
public static function MOD($a = 1, $b = 1)
{
$a = Functions::flattenSingleValue($a);
$b = Functions::flattenSingleValue($b);
$a = (float) Functions::flattenSingleValue($a);
$b = (float) Functions::flattenSingleValue($b);
if ($b == 0.0) {
return Functions::DIV0();

View File

@ -46,4 +46,9 @@ return [
1.3,
1.2,
],
[
'',
1,
0,
],
];