Core Function FDec
From Sputnik Wiki
(Difference between revisions)
UberFoX (Talk | contribs)
(Created page with "<pre> FDec( <expression> ) </pre> === Description === Returns a float representation of a hexadecimal string. === Parameters === ==== expression ==== The hexadecimal string ...")
Newer edit →
(Created page with "<pre> FDec( <expression> ) </pre> === Description === Returns a float representation of a hexadecimal string. === Parameters === ==== expression ==== The hexadecimal string ...")
Newer edit →
Revision as of 07:03, 11 November 2011
FDec( <expression> )
Contents |
Description
Returns a float representation of a hexadecimal string.
Parameters
expression
The hexadecimal string to convert.
Return Value
Success: Returns a float.
Failure: Returns 0.
Remarks
The function only works with numbers that fit in a 32 bit signed floating point.
Example
$lol = (float)1337.42 $fHex = fHex($lol) $fDec = fDec($fHex) println( "FLOAT HEX: " . $fHex ) ; Prints 44A72D71 println( "FLOAT DEC: " . $fDec ) ; Prints 1337.42004394531
Example with cast on a $variable
$var = 1337.77 $fHex = fHex((float)$var) $fDec = fDec($fHex) println( "FLOAT HEX: " . $fHex ) ; Prints 44A72D71 println( "FLOAT DEC: " . $fDec ) ; Prints 1337.42004394531