/hphp/test/zend/good/ext/standard/tests/math/abs.php
PHP | 19 lines | 17 code | 2 blank | 0 comment | 0 complexity | 3571bc316c2bffbbecfa1e47fe10e600 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?hh
- <<__EntryPoint>> function main(): void {
- $long_max = is_int(5000000000)? (float)9223372036854775807 : (float)0x7FFFFFFF;
- $long_min = -$long_max - 1;
- printf("%d,%d,%d,%d\n",is_float($long_min ),is_float($long_max ),
- is_int($long_min-1),is_int($long_max+1));
- $tests = <<<TESTS
- 1 === abs(-1)
- 1.5 === abs(-1.5)
- 1 === abs("-1")
- 1.5 === abs("-1.5")
- -($long_min+1) === abs($long_min-1)
- -($long_min) === abs($long_min)
- -($long_min+1) === abs($long_min+1)
- TESTS;
- include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
- }