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

From: Date: Mon, 27 Mar 2006 23:15:11 +0000
Subject: #36849 [Bgs->Opn]: hex to float request
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94949@lists.php.net to get a copy of this message
ID: 36849 User updated by: esri at godseyfamily dot com Reported By: esri at godseyfamily dot com -Status: Bogus +Status: Open Bug Type: Feature/Change Request Operating System: Liinux PHP Version: 5.1.2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 http://bugs.php.net/?id=36849&edit=1

« previous php.bugs (#94949) next »