PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/good/ext/standard/tests/math/abs.php

http://github.com/facebook/hiphop-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
  1. <?hh
  2. <<__EntryPoint>> function main(): void {
  3. $long_max = is_int(5000000000)? (float)9223372036854775807 : (float)0x7FFFFFFF;
  4. $long_min = -$long_max - 1;
  5. printf("%d,%d,%d,%d\n",is_float($long_min ),is_float($long_max ),
  6. is_int($long_min-1),is_int($long_max+1));
  7. $tests = <<<TESTS
  8. 1 === abs(-1)
  9. 1.5 === abs(-1.5)
  10. 1 === abs("-1")
  11. 1.5 === abs("-1.5")
  12. -($long_min+1) === abs($long_min-1)
  13. -($long_min) === abs($long_min)
  14. -($long_min+1) === abs($long_min+1)
  15. TESTS;
  16. include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
  17. }