Skip to content

[pdo_firebird] float, double value is incorrect #13119

Description

@SakiTakamachi

Description

The following code:

<?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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions