Navigation

Operators and Keywords

Function List:

C++ API

: s = num2hex (n)

Typecast a double or single precision number or vector to a 8 or 16 character hexadecimal string of the IEEE 754 representation of the number.

For example:

num2hex ([-1, 1, e, Inf])
⇒ "bff0000000000000
   3ff0000000000000
   4005bf0a8b145769
   7ff0000000000000"

If the argument n is a single precision number or vector, the returned string has a length of 8. For example:

num2hex (single ([-1, 1, e, Inf]))
⇒ "bf800000
   3f800000
   402df854
   7f800000"

See also: hex2num, hex2dec, dec2hex.

Package: octave