Convert number to hexadecimal equivalent using quantizer
object
num2hex
and hex2num
are inverses of each other, except that hex2num
returns the hexadecimal values in a column.
For fixed-point quantizer
objects, the representation is two's
complement.
For floating-point quantizer
objects, the representation is
IEEE® Standard 754 style.
For example, for q = quantizer('double')
:
q = quantizer('double');
num2hex(q,nan)
ans = 'fff8000000000000'
The leading fraction bit is 1, and all the other fraction bits are 0. Sign bit is 1, and exponent bits are all 1.
num2hex(q,inf)
ans = '7ff0000000000000'
Sign bit is 0, exponent bits are all 1, and all fraction bits are 0.
num2hex(q,-inf)
ans = 'fff0000000000000'
Sign bit is 1, exponent bits are all 1, and all fraction bits are 0.