|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26959 the same script with (float)"0xABCDEF" shows different on different OS
Submitted: 2004-01-19 00:26 UTC Modified: 2004-01-21 21:09 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bugz at nagash dot org Assigned:
Status: Not a bug Package: Math related
PHP Version: 4CVS, 5CVS OS: Unix \ FreeBSD \ Windows
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.
Block user comment
Status: Assign to:
Bug Type:
From: bugz at nagash dot org
New email:
PHP Version: OS:


 [2004-01-19 00:26 UTC] bugz at nagash dot org
echo (float)("0xABCDEF");

on the Windows XP and FreeBSD 4.9 it shows: "0"
on the Unix systems (tested slackware 8 and RedHat) AND MacOS it shows: "11259375"

Reproduce code:
echo (float)("0xABCDEF");

Expected result:
I expected to see "11259375"

Actual result:
on the different system I see "0" or "11259375"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-19 13:17 UTC]
This works everywhere like it should:

echo (float) 0xABCDEF;

 [2004-01-19 19:55 UTC] bugz at nagash dot org
I know it that if I write --- echo (float) 0xABCDEF;
but if I have string with hex value in it. and I want to get "int" or "float" as I wrote in my example - I will get different result on different OS
 [2004-01-19 20:01 UTC] bugz at nagash dot org
another example
$var = "0xABCDEF"; // I have this string
$var = (float)$var; // I want to have 'float'
echo $var; // different OS \ different results
 [2004-01-21 21:09 UTC]
Win32 / *BSD strtod(3) libc function does not support this, see also:

This is not PHP bug.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 05:01:30 2024 UTC