[php-src] Issue #13119: [pdo_firebird] float, double value is incorrect

From: Date: Wed, 10 Jan 2024 17:04:27 +0000
Subject: [php-src] Issue #13119: [pdo_firebird] float, double value is incorrect
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246218@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13119 Author: SakiTakamachi ### Description The following code: ```php <?php $db = new PDO(/* firebird */); $db->exec('CREATE TABLE test (f_val FLOAT, d_val DOUBLE PRECISION)'); $db->exec('INSERT INTO test VALUES (0.0000001, 0.00000001)'); $stmt = $db->query('select * from test'); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); ``` Resulted in this output: ``` array(1) { [0]=> array(2) { ["F_VAL"]=> string(8) "0.000000" ["D_VAL"]=> string(8) "0.000000" } } ``` But I expected this output instead: ``` array(1) { [0]=> array(2) { ["F_VAL"]=> string(8) "0.0000001" ["D_VAL"]=> string(8) "0.00000001" } } ``` After trying various things, it seems that the fraction part is displayed as a fixed 6 digits. e.g. 12.000000001 => 12.000000 It's late today, so I'll try again tomorrow. (In the first place, I think I want the value to be a native type, but I won't consider that for now.) ### PHP Version >= PHP8.2 ### Operating System Ubuntu20.04(docker)

« previous php.bugs (#246218) next »