Core Function DHex

From Sputnik Wiki
Revision as of 06:58, 11 November 2011 by UberFoX (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
DHex( <expression> )

Contents

Description

Returns a string representation of an double type converted to hexadecimal

Parameters

expression

The expression to convert.

Return Value

Success: Returns a string of length characters, zero-padded if necessary for integer.

Failure: Returns "" (blank string).

Remarks

The function only works with numbers that fit in a 64 bit signed floating point.

It is best to cast numbers with (double) to make sure its going to be a double.

Example

$lol1 = (double)1337.77
$fDHex = DHex($lol1)
$fDDec = DDec($fDHex)
println( "DOUBLE HEX: " . $fDHex ) ; Prints 4094E7147AE147AE
println( "DOUBLE DEC: " . $fDDec ) ; Prints 1337.77

Example with cast on a $variable

$var = 1337.77
$fDHex = DHex((double)$var)
$fDDec = DDec($fDHex)
println( "DOUBLE HEX: " . $fDHex ) ; Prints 4094E7147AE147AE
println( "DOUBLE DEC: " . $fDDec ) ; Prints 1337.77
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox