1--TEST--
2Random: Randomizer: getFloat(): Extreme ranges are handled correctly
3--FILE--
4<?php
5
6use Random\Engine;
7use Random\Randomizer;
8
9final class TestEngine implements Engine
10{
11    private array $values = [
12        "\x64\xe8\x58\x79\x3e\xf6\x38\x00",
13        "\x65\xe8\x58\x79\x3e\xf6\x38\x00",
14        "\x00\x00\x00\x00\x00\x00\x00\x00",
15    ];
16
17    public function generate(): string
18    {
19        return \array_shift($this->values);
20    }
21}
22
23$r = new Randomizer(new TestEngine());
24
25$min = -1.6e308;
26$max = 1.6e308;
27printf("%.17g\n", $min);
28printf("%.17g\n\n", $max);
29
30printf("%.17g\n", $r->getFloat($min, $max));
31printf("%.17g\n", $r->getFloat($min, $max));
32printf("%.17g\n", $r->getFloat($min, $max));
33
34?>
35--EXPECT--
36-1.6e+308
371.6e+308
38
39-1.5999999999999998e+308
40-1.6e+308
411.5999999999999998e+308
42