#45854 [Asn]: intval returns a negative number

[email protected] ("olivarra1 at hotmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45854
 User updated by:  olivarra1 at hotmail dot com
 Reported By:      olivarra1 at hotmail dot com
 Status:           Assigned
 Bug Type:         Math related
 Operating System: win32 only
 PHP Version:      5.2CVS, 5.3CVS, 6CVS (2008-08-18)
 Assigned To:      pajoye
 New Comment:

I've tried 5.2.7-dev, but it gives me the same result.

And what does "nevermind" mean? It's a bug, and it have to be solved.
If we say nevermind to all of bugs we won't develop.

Mhh, maybe it's a windows bug, not a php bug?

thanks,
olivarra1


Previous Comments:
------------------------------------------------------------------------

[2008-08-18 18:13:15] [email protected]

Nevermind, happens within all branches, but only with windows.

------------------------------------------------------------------------

[2008-08-18 15:56:12] olivarra1 at hotmail dot com

version was 5.2.1, not 5.2CVS-2008-08-18 (CVS)

------------------------------------------------------------------------

[2008-08-18 15:53:16] olivarra1 at hotmail dot com

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 this bug report at http://bugs.php.net/?id=45854&edit=1
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.