Skip to content

Float handling changes since 8.0 - on purpose? #9587

@Guite

Description

@Guite

Description

The following code:

<?php
$a = 676.71;
$b = 108.05;

var_dump($a - $b);

Resulted in this output:

float(568.6600000000001)

But I expected this output instead:

float(568.66)

image

This BC break is not documented at https://www.php.net/manual/en/migration80.incompatible.php

Hence, I'd consider this a bug.

PHP Version

PHP 8.*

Operating System

any

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions