xref: /PHP-8.1/Zend/tests/dval_to_lval_64.phpt (revision c5401854)
1--TEST--
2zend_dval_to_lval preserves low bits  (64 bit long)
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8)
6     die("skip for machines with 64-bit longs");
7?>
8--FILE--
9<?php
10    /* test doubles around -4e21 */
11    $values = [
12        -4000000000000001048576.,
13        -4000000000000000524288.,
14        -4000000000000000000000.,
15        -3999999999999999475712.,
16        -3999999999999998951424.,
17    ];
18
19    foreach ($values as $v) {
20        var_dump((int)$v);
21    }
22
23?>
24--EXPECT--
25int(2943463994971652096)
26int(2943463994972176384)
27int(2943463994972700672)
28int(2943463994973224960)
29int(2943463994973749248)
30