xref: /PHP-8.0/ext/filter/tests/050.phpt (revision f8d79582)
1--TEST--
2filter_var() and double overflow/underflow
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--FILE--
6<?php
7$test = array(
8    '1e+308'					=> 1e+308,
9    '1e+309'					=> false,
10    '1e-323'					=> 1e-323,
11    '1e-324'					=> false,
12);
13foreach ($test as $src => $dst) {
14    $out = filter_var($src, FILTER_VALIDATE_FLOAT);
15    if ($dst !== $out) {
16        if ($out === false) {
17            echo "$src -> false != $dst\n";
18        } elseif ($dst === false) {
19            echo "$src -> $out != false\n";
20        } else {
21            echo "$src -> $out != $dst\n";
22        }
23    }
24}
25
26echo "Ok\n";
27?>
28--EXPECT--
29Ok
30