mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-07 03:29:30 +00:00
Fixed warning on PHP8.5
This commit is contained in:
parent
ae787530ff
commit
1f2a7b86e5
1 changed files with 5 additions and 0 deletions
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue