Core Function DHex

From Sputnik Wiki
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