#45854 [NEW]: intval returns a negative number

[email protected] ("olivarra1 at hotmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             olivarra1 at hotmail dot com
Operating system: Windows XP Professional
PHP version:      5.2CVS-2008-08-18 (CVS)
PHP Bug Type:     Math related
Bug description:  intval returns a negative number

Description:
------------
For too big numbers, intval returns a negative value

Reproduce code:
---------------
<?php
  $a = 25 * pow(1.5, 50);
  echo $a."<br>";
  echo intval($a)."<br>";

  echo "<br>";

  $a = 10 * pow(1.5, 60);
  echo $a."<br>";
  echo intval($a)."<br>";
?>

Expected result:
----------------
15940537505.4
15940537505

367684687169
367684687169

Actual result:
--------------
15940537505.4
-1239331679

367684687169
-1682500287

-- 
Edit bug report at http://bugs.php.net/?id=45854&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45854&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45854&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45854&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45854&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45854&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45854&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45854&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45854&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45854&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45854&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45854&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45854&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45854&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45854&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45854&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45854&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45854&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45854&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45854&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45854&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.