[php-src] Issue #12357: Wrong float result while subtraction

From: Date: Wed, 04 Oct 2023 15:29:46 +0000
Subject: [php-src] Issue #12357: Wrong float result while subtraction
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245496@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12357
Author: cancelledbit

### Description

The following code:

```php
<?php
var_dump(round((float)4.3, 1) - round((float)4.217125382262997, 1));
```

Resulted in this output:
```
float(0.09999999999999964)
```

But I expected this output instead:
```
float(0.1)
```

And by the way, php 7.4 was doing it perfectly fine, this code results 0.1 implementing on 7.4


### PHP Version

PHP 8.2 8.1 8.0

### Operating System

Ubuntu 22.04


Thread (1 message)

  • cancelledbit
« previous php.bugs (#245496) next »