James Cole 2022-12-27 17:17:00 +01:00
parent 1f4ca9c8fe
commit f350948fb2
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -105,15 +105,18 @@ class Steam
*/
public function bcround(?string $number, int $precision = 0): string
{
if(null === $number) {
return '0';
}
if('' === trim($number)) {
return '0';
}
// if the number contains "E", it's in scientific notation, so we need to convert it to a normal number first.
if(false !== stripos($number,'e')) {
$number = sprintf('%.24f',$number);
}
Log::debug(sprintf('Trying bcround("%s",%d)', $number, $precision));
if (str_contains($number, '.')) {
if ($number[0] !== '-') {