In MATLAB, the normalized, regularly rounded representation of 0.654 in the floating-point number system f=[a=2,k−=−6,k+=6,t=5]
can be obtained using the round
and log2
functions as follows:
main.m193 chars5 lines
The resulting f_rep
will be [0, 6, 101101]
, since the binary representation of 0.654 is 0.10101010101010101010...
, which rounds up to 0.101101
when normalized and rounded to 5 bits. Thus, the IEEE-754 representation of 0.654 in the given floating-point format would be 0 0110 1011010000
.
gistlibby LogSnag