File tree 1 file changed +2
-12
lines changed
1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -628,19 +628,9 @@ public function execute(object $connection = null): DbalResult
628
628
final public static function castFloatToString (float $ value ): string
629
629
{
630
630
$ precisionBackup = ini_get ('precision ' );
631
+ ini_set ('precision ' , '-1 ' );
631
632
try {
632
- // loop needed, see https://github.com/php/php-src/issues/8509
633
- // fixed precision of 17 for conversion can render unneeded decimal digits like
634
- // 0.40000000000000002 although 0.4 is enough to represent such float number exactly
635
- for ($ i = 1 ; $ i <= 17 ; ++$ i ) {
636
- ini_set ('precision ' , (string ) $ i );
637
- $ res = (string ) $ value ;
638
- if ((float ) $ res === $ value ) {
639
- return $ res ;
640
- }
641
- }
642
-
643
- return $ res ;
633
+ return (string ) $ value ;
644
634
} finally {
645
635
ini_set ('precision ' , $ precisionBackup );
646
636
}
You can’t perform that action at this time.
0 commit comments