mirror of
https://github.com/php/php-src.git
synced 2024-12-15 12:54:57 +08:00
a939805641
var_dump() is debugging functionality, so it should print floating-point numbers accurately. We do this by switching to serialize_precision, which (by default) will print with as much precision as necessary to preserve the exact value of the float. This also affects debug_zval_dump(). Closes GH-5172.
33 lines
364 B
PHP
33 lines
364 B
PHP
--TEST--
|
|
dividing doubles
|
|
--INI--
|
|
precision=14
|
|
--FILE--
|
|
<?php
|
|
|
|
$d1 = 1.1;
|
|
$d2 = 434234.234;
|
|
|
|
$c = $d2 / $d1;
|
|
var_dump($c);
|
|
|
|
$d1 = 1.1;
|
|
$d2 = "434234.234";
|
|
|
|
$c = $d2 / $d1;
|
|
var_dump($c);
|
|
|
|
$d1 = "1.1";
|
|
$d2 = "434234.234";
|
|
|
|
$c = $d2 / $d1;
|
|
var_dump($c);
|
|
|
|
echo "Done\n";
|
|
?>
|
|
--EXPECT--
|
|
float(394758.39454545453)
|
|
float(394758.39454545453)
|
|
float(394758.39454545453)
|
|
Done
|