Skip to content

PHP Warning: Loss of data on string conversion #83

@balexus

Description

@balexus
<?php
     use Decimal\Decimal;
     $s = new Decimal("71.610",3);
     $e  = $s+1-1;
     echo $e;
?>

The code show warning
"PHP Warning: Loss of data on string conversion" on line 3
but if change precision from 3 to 4:
i.e.
$s = new Decimal("71.610",4);

It works

Why ?

I have noticed that same issue happen when
i use

$s = new Decimal("222.16",3);
Where is a problem ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions