Skip to content

Wrong scale for BcMath\Number::div result with big numbers #17696

Closed as not planned
@Sandritsch91

Description

@Sandritsch91

Description

The following code:

<?php
// $n1 > 10^10 results in wrong scale
$n1 = new \BcMath\Number('100000000000');
$n2 = new \BcMath\Number('1');
echo $n2->div($n1);

Resulted in this output:

0

But I expected this output instead:

0.00000000001

3v4l.org

PHP Version

PHP 8.4.3

Operating System

Windows 11 Pro 24H2, Linux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions