Skip to content

Commit

Permalink
Fixing number helper for floating 0.0 (#486)
Browse files Browse the repository at this point in the history
Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
  • Loading branch information
huangdijia and huangdijia authored Dec 10, 2023
1 parent e54872e commit 4012af9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ protected static function summarize(int|float $number, int $precision = 0, ?int
}

switch (true) {
case $number === 0:
return '0';
case floatval($number) === 0.0:
return $precision > 0 ? static::format(0, $precision, $maxPrecision) : '0';
case $number < 0:
return sprintf('-%s', static::summarize(abs($number), $precision, $maxPrecision, $units));
case $number >= 1e15:
Expand Down

0 comments on commit 4012af9

Please sign in to comment.