Req #36849 [Opn->Csd]: hex to float request

From: Date: Fri, 09 Jan 2015 00:15:06 +0000
Subject: Req #36849 [Opn->Csd]: hex to float request
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189799@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=36849&edit=1 ID: 36849 Updated by: ajf@php.net Reported by: esri at godseyfamily dot com Summary: hex to float request -Status: Open +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: Liinux PHP Version: 5.1.2 -Assigned To: +Assigned To: ajf Block user comment: N Private report: N New Comment: Use unpack(). Previous Comments: ------------------------------------------------------------------------ [2006-03-28 01:15:10] esri at godseyfamily dot com That does not change my request for a feature. There is no way of converting to type float or double from a raw form. This is what I'm asking for. 0x3F800000 should be able to be converted to 1.000000 This is a feature request, as indicated in the Category. ------------------------------------------------------------------------ [2006-03-28 00:27:05] tony2001@php.net >What I am getting is the integer value And the reason is: #php -r 'echo 0x3f800000;' 1065353216 ------------------------------------------------------------------------ [2006-03-28 00:24:04] esri at godseyfamily dot com $num = 0x3F800000; printf("%f",$num); I would expect a return value of: 1.00000 What I am getting is the integer value: 1065353216.000000 ------------------------------------------------------------------------ [2006-03-24 21:17:29] esri at godseyfamily dot com Description: ------------ Would simply like to input a hex value and get the float of it back. The settype of course does not work, or any kind of casting. A function that parses the binary string introduces a huge amount of overhead when I do 1024 of these values in a row. I would think that any programming language would have this basic capability. I'm getting raw data, and a data type that it needs to be converted to. I checked and didn't see this requested, though I'm sure it has been. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=36849&edit=1

« previous php.bugs (#189799) next »