|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-02-06 06:30 UTC] rasmus@php.net
-Status: Open
+Status: Not a bug
[2018-02-06 06:30 UTC] rasmus@php.net
[2018-02-06 08:59 UTC] km dot wrona at gmail dot com
[2018-02-06 09:18 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 14:00:01 2025 UTC |
Description: ------------ The number is not represented properly when the column is defined as decimal. Test script: --------------- var_dump($this->selectRaw('CAST(\'1.6\' as decimal(10,2)) as dec, CAST(\'1.6\' as float) as flo')->limit(1)->get()); exit; array(1) { [0]=> object(stdClass)#789 (2) { ["dec"]=> float(1.5999999999999) ["flo"]=> float(1.6) } } //default behaviour ["dec"]=> float(1.5999999999999) //with //ini_set('precision', 25); //ini_set('serialize_precision', 25); ["dec"]=> float(1.599999999999909050529823) Expected result: ---------------- 1.6 no matter if decimal or float