[php-src] Issue #8020: json_encode precision bug
| From: | hamak2 | Date: | Tue, 01 Feb 2022 16:56:23 +0000 |
| Subject: | [php-src] Issue #8020: json_encode precision bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239412@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8020
Author: hamak2
### Description
The following code:
```php
<?php
$test['amount'] = 2.7964*10000;
echo json_encode($test);
```
Resulted in this output:
```
{"amount":27964.000000000004}
```
But I expected this output instead:
```
{"amount":27964}
```
### PHP Version
8.0.12
### Operating System
Ubuntu 20.04