Fixed warning on PHP8.5

This commit is contained in:
Jan Böhmer 2025-10-17 22:39:58 +02:00
parent ae787530ff
commit 1f2a7b86e5

View file

@ -38,6 +38,11 @@ class SIFormatter
*/
public function getMagnitude(float $value): int
{
//Check for zero, as log10(0) is undefined/gives -infinity, which leads to casting issues in PHP8.5+
if (0.0 === $value) {
return 0;
}
return (int) floor(log10(abs($value)));
}