xref: /PHP-7.3/Zend/tests/double_to_string.phpt (revision 782352c5)
1--TEST--
2double to string conversion tests
3--INI--
4precision=14
5--SKIPIF--
6<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
7--FILE--
8<?php
9
10$doubles = array(
11	290000000000000000,
12	290000000000000,
13	29000000000000,
14	29000000000000.123123,
15	29000000000000.7123123,
16	29000.7123123,
17	239234242.7123123,
18	0.12345678901234567890,
19	10000000000000,
20	100000000000000,
21	1000000000000000001,
22	100000000000001,
23	10000000000,
24	999999999999999,
25	9999999999999999,
26	(float)0
27	);
28
29foreach ($doubles as $d) {
30	var_dump((string)$d);
31}
32
33echo "Done\n";
34?>
35--EXPECTF--
36string(7) "2.9E+17"
37string(7) "2.9E+14"
38string(%d) "2%s"
39string(%d) "2%s"
40string(%d) "29%d"
41string(13) "29000.7123123"
42string(15) "239234242.71231"
43string(16) "0.12345678901235"
44string(14) "10000000000000"
45string(7) "1.0E+14"
46string(7) "1.0E+18"
47string(7) "1.0E+14"
48string(11) "10000000000"
49string(7) "1.0E+15"
50string(7) "1.0E+16"
51string(1) "0"
52Done
53