DECIMAL (Text, Radix?) DECIMAL (Text; Radix?)

Text

Text Text

The textual representation of the number.

Radix

Number Number (optional)

The base (radix). If omitted, it is assumed to be 10.

Returns

Number Number

The converted decimal number.

Converts a textual representation of a number in a given base to a decimal number. DECIMAL ("F", 16) DECIMAL ("F"; 16) returns 15, because F in hexadecimal (base 16) equals 15 in base 10.

Use the BASE function to convert a decimal number to another base. Also consider using the more specialized BIN2DEC, OCT2DEC and HEX2DEC functions.

Examples

DECIMAL ("F", 16)
DECIMAL ("F"; 16)

Returns 15, because F in hexadecimal (base 16) equals 15 in base 10.

DECIMAL ("FF", 16)
DECIMAL ("FF"; 16)

Returns 255, because F in hexadecimal (base 16) equals 255 in base 10.

HEX2DEC ("FF")
HEX2DEC ("FF")

Returns 255, because F in hexadecimal (base 16) equals 255 in base 10.

DECIMAL ({ "F", "FF" }, 16)
DECIMAL ({ "F"; "FF" }; 16)

Returns the array { 15, 255 }{ 15; 255 }, because F and FF in hexadecimal (base 16) equal 15 and 255 in base 10.

DECIMAL ({ "101", "FF" }, { 2, 16 })
DECIMAL ({ "101"; "FF" }; { 2; 16 })

Returns the array { 5, 255 }{ 5; 255 }, because 101 in binary (base 2) equals 5 in base 10 and FF in hexadecimal (base 16) equal 15 in base 10.

DECIMAL ("zap", 36)
DECIMAL ("zap"; 36)

Returns 45745, because ZAP in base 36 equals 45745 in base 10.

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell