|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-12-04 08:43 UTC] aharvey@php.net
[2012-12-04 08:43 UTC] aharvey@php.net
-Status: Open
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ when I used pdo for the sql "select round(863521.777777778, 2) as a", it gets wrong result 863521.780000001 Test script: --------------- <?php $db = new PDO("sqlite:../test.s3db"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $st = $db->query('select round(863521.777777778, 2) as a'); $data = $st->fetchAll(); print_r($data); $st = $db->query('select round(372366.577777778, 2) as a'); $data = $st->fetchAll(); print_r($data); Expected result: ---------------- Array ( [0] => Array ( [a] => 863521.780000001 [0] => 863521.780000001 ) ) Array ( [0] => Array ( [a] => 372366.58 [0] => 372366.58 ) )