[php-src] Issue #12075: Floats rounds down

From: Date: Tue, 29 Aug 2023 17:51:00 +0000
Subject: [php-src] Issue #12075: Floats rounds down
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245285@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12075
Author: sinnbeck

### Description

The following code:

```php
<?php
echo number_format($contents['value'], 1);
echo round($contents['value'], 1);
```

Resulted in this output:
```
5.7
5.7
```

But I expected this output instead:
```
5.8
5.8
```
This happens after upgrading to php 8.2.9 and getting this fix
>Fix [GH-11587](https://github.com/php/php-src/issues/11587) (After php8.1, when
>PDO::ATTR_EMULATE_PREPARES is true and PDO::ATTR_STRINGIFY_FETCHES is true, decimal zeros are no
>longer filled).

The value from the database is 5.75 and in all other versions it is rounded to 5.8 without a
problem.

PDO::ATTR_EMULATE_PREPARES is true and PDO::ATTR_STRINGIFY_FETCHES is true

![image](https://github.com/php/php-src/assets/13980140/863ad9d3-2c6b-4d5c-92f2-43326329aa2e)



### PHP Version

PHP 8.2.0

### Operating System

Ubuntu 20.04


Thread (1 message)

  • sinnbeck
« previous php.bugs (#245285) next »