mirror of
https://github.com/php/php-src.git
synced 2024-12-25 01:40:50 +08:00
37 lines
383 B
PHP
37 lines
383 B
PHP
--TEST--
|
|
Conversion of special float values to int
|
|
--FILE--
|
|
<?php
|
|
$values = [
|
|
0.0,
|
|
INF,
|
|
-INF,
|
|
1 / INF,
|
|
-1 / INF, // Negative zero,
|
|
NAN
|
|
];
|
|
|
|
foreach($values as $value) {
|
|
var_dump($value);
|
|
var_dump((int)$value);
|
|
echo PHP_EOL;
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
float(0)
|
|
int(0)
|
|
|
|
float(INF)
|
|
int(0)
|
|
|
|
float(-INF)
|
|
int(0)
|
|
|
|
float(0)
|
|
int(0)
|
|
|
|
float(-0)
|
|
int(0)
|
|
|
|
float(NAN)
|
|
int(0)
|