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.

Division by zero error in div() #58

@maff

Description

@maff

When using the library for divisions at a higher scale, you can run into division by zero errors:

<?php

declare(strict_types=1);

use Litipk\BigNumbers\Decimal;

require_once __DIR__ . '/vendor/autoload.php';

$value = Decimal::create('12.99', 4);
$divisor = Decimal::create(2, 4);

var_dump($value->div($divisor));
Warning: bcdiv(): Division by zero in src/Decimal.php on line 1155

The affected part is the innerLog10 method used while calculating the division.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions