[php-src] Issue #14332: `number_format` no longer round properly big float
| From: | kylekatarnls | Date: | Sun, 26 May 2024 12:43:36 +0000 |
| Subject: | [php-src] Issue #14332: `number_format` no longer round properly big float | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246969@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14332
Author: kylekatarnls
### Description
The following code:
```php
<?php
echo number_format(1599828571.23561241, 6, '.', '');
```
Resulted in this output:
```
1599828571.235613
```
But I expected this output instead:
```
1599828571.235612
```
This is the result with PHP < 8.4 and it sounds good to me either we consider
round() or floor() as the best operation to use.
Context: precision matters in my case, as I aim to support float timestamp (possibly more precise
than microseconds) then to round them as close as possible and in a consistent manner.
### PHP Version
8.4 (master 2024-05-26)
### Operating System
_No response_