[S,E,F] = IEEE754(X) returns the sign bit, exponent, and mantissa of an IEEE 754 floating point value X, expressed as binary digit strings of length 1, 11, and 52, respectively.
X is equal to (in exact arithmetic and decimal notation)
(-1)^S * (1 + F/(2^52)) * 2^(E-1023),
except for special values 0, Inf, NaN, and denormalized numbers (between 0 and REALMIN).
Toby Driscoll (2020). IEEE 754 binary representation (https://www.mathworks.com/matlabcentral/fileexchange/25326-ieee-754-binary-representation), MATLAB Central File Exchange. Retrieved .
Could someone help me in using this code.
I tried using this [a,b,c]=ieee754(-176.234,'dec');
but it's displaying it as error.
Is there a version to handle Single Precision numbers?
Excellent. Very useful when teaching students about floating point arithmetic.
A request: could you add single conversion as well!?
Used NUM2HEX in place of SPRINTF, per suggestion by Andreas Luettgens.