php.net |  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
Votes:1
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
 [2004-01-19 00:26 UTC] bugz at nagash dot org
Description:
------------
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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-19 13:17 UTC] sniper@php.net
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] sniper@php.net
Win32 / *BSD strtod(3) libc function does not support this, see also:

http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion

This is not PHP bug.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC