Navigation

Operators and Keywords

Function List:

C++ API

: n = hex2num (s)
: n = hex2num (s, class)

Typecast the 16 character hexadecimal character string to an IEEE 754 double precision number.

If fewer than 16 characters are given the strings are right padded with '0' characters.

Given a string matrix, hex2num treats each row as a separate number.

hex2num (["4005bf0a8b145769"; "4024000000000000"])
  ⇒ [2.7183; 10.000]

The optional argument class can be passed as the string "single" to specify that the given string should be interpreted as a single precision number. In this case, s should be an 8 character hexadecimal string. For example:

hex2num (["402df854"; "41200000"], "single")
  ⇒ [2.7183; 10.000]

See also: num2hex, hex2dec, dec2hex.

Package: octave