1--TEST--
2Test range() function with non finite numbers
3--INI--
4serialize_precision=14
5--FILE--
6<?php
7// 0/0 NAN value
8$f1 = fdiv(0, 0);
9var_dump($f1);
10// INF/INF NAN value
11$f2 = fdiv(10.0**400, 9.0**400);
12var_dump($f2);
13// -INF + +INF NAN value
14$f3 = (-10.0**400) + (9.0**400);
15var_dump($f3);
16
17$fs = [$f1, $f2, $f3, 5.5];
18
19foreach ($fs as $s) {
20    foreach ($fs as $e) {
21        echo "range($s, $e);\n";
22        try {
23            var_dump( range($s, $e) );
24        } catch (\ValueError $e) {
25            echo $e->getMessage(), PHP_EOL;
26        }
27    }
28}
29
30?>
31--EXPECT--
32float(NAN)
33float(NAN)
34float(NAN)
35range(NAN, NAN);
36range(): Argument #1 ($start) must be a finite number, NAN provided
37range(NAN, NAN);
38range(): Argument #1 ($start) must be a finite number, NAN provided
39range(NAN, NAN);
40range(): Argument #1 ($start) must be a finite number, NAN provided
41range(NAN, 5.5);
42range(): Argument #1 ($start) must be a finite number, NAN provided
43range(NAN, NAN);
44range(): Argument #1 ($start) must be a finite number, NAN provided
45range(NAN, NAN);
46range(): Argument #1 ($start) must be a finite number, NAN provided
47range(NAN, NAN);
48range(): Argument #1 ($start) must be a finite number, NAN provided
49range(NAN, 5.5);
50range(): Argument #1 ($start) must be a finite number, NAN provided
51range(NAN, NAN);
52range(): Argument #1 ($start) must be a finite number, NAN provided
53range(NAN, NAN);
54range(): Argument #1 ($start) must be a finite number, NAN provided
55range(NAN, NAN);
56range(): Argument #1 ($start) must be a finite number, NAN provided
57range(NAN, 5.5);
58range(): Argument #1 ($start) must be a finite number, NAN provided
59range(5.5, NAN);
60range(): Argument #2 ($end) must be a finite number, NAN provided
61range(5.5, NAN);
62range(): Argument #2 ($end) must be a finite number, NAN provided
63range(5.5, NAN);
64range(): Argument #2 ($end) must be a finite number, NAN provided
65range(5.5, 5.5);
66array(1) {
67  [0]=>
68  float(5.5)
69}
70