File Exchange

image thumbnail

IEEE 754 binary representation

version (1.67 KB) by Toby Driscoll
Converts a double into its underlying 64-bit representation, including sign, exponent, and mantissa.


Updated 31 Oct 2013

View Version History

View License

[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).

Cite As

Toby Driscoll (2021). IEEE 754 binary representation (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

giorgia calisti

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.

Milad Abdollahi

Royi Avital

Is there a version to handle Single Precision numbers?

Lokesh Ravindranathan

Derek O'Connor

Excellent. Very useful when teaching students about floating point arithmetic.

Derek O'Connor


A request: could you add single conversion as well!?

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!