Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

bcdiv() division by zero error #53

@djmattyg007

Description

@djmattyg007

When running the following code, I get a PHP division by zero warning: PHP Warning: bcdiv(): Division by zero in vendor/litipk/php-bignumbers/src/Decimal.php on line 1140

<?php
declare(strict_types=1);
require("vendor/autoload.php");
use Litipk\BigNumbers\Decimal;

$d1 = Decimal::create(192078120.5, 28);
$d2 = Decimal::create(31449600, 28);

echo $d1->div($d2);

If I remove the .5 from the first value, the division by zero warning does not occur. Similarly, if I pass 28 as the second parameter to div(), the warning does not occur.

I'm using v0.8.2 of this package, running on PHP 7.1.2 (cli) with opcache enabled. Xdebug is not installed. Please don't hesitate to request more information.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions