Skip to content

Commit 1f2a7b8

Browse files
committed
Fixed warning on PHP8.5
1 parent ae78753 commit 1f2a7b8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Services/Formatters/SIFormatter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class SIFormatter
3838
*/
3939
public function getMagnitude(float $value): int
4040
{
41+
//Check for zero, as log10(0) is undefined/gives -infinity, which leads to casting issues in PHP8.5+
42+
if (0.0 === $value) {
43+
return 0;
44+
}
45+
4146
return (int) floor(log10(abs($value)));
4247
}
4348

0 commit comments

Comments
 (0)