php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22179 convert float to int crashes
Submitted: 2003-02-11 18:59 UTC Modified: 2003-02-20 08:18 UTC
From: csmall at enc dot com dot au Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 4.2.3 OS: Debian GNU/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: csmall at enc dot com dot au
New email:
PHP Version: OS:

 

 [2003-02-11 18:59 UTC] csmall at enc dot com dot au
<?
$b = "NAN";
$c = (float)$b;
$sum = 0;
$sum+= (int)$c;
echo "B is $b, C is $c, sum is $sum\n";
?>

i386 says sum is 0
alpha just does a floating point exception
sparc64 says sum is 2147483647
powerpc says sum is -2147483648

It should be 0, I guess.

If you prefer a one-liner:
<? echo (int)((float)"NAN")."\n"; ?>

Same result.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-20 08:18 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 15:01:29 2024 UTC