23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2 Data Types<br />

Floating-Point Numbers<br />

<strong>MATLAB</strong> represents floating-point numbers in either double-precision or<br />

single-precision format. The default is double precision, but you can make<br />

any number single precision with a simple conversion function.<br />

This section covers:<br />

• “Double-Precision Floating Point” on page 2-14<br />

• “Single-Precision Floating Point” on page 2-15<br />

• “Creating Floating-Point Data” on page 2-15<br />

• “Arithmetic Operations on Floating-Point Numbers” on page 2-17<br />

• “Largest and Smallest Values for Floating-Point Data Types” on page 2-18<br />

• “Accuracy of Floating-Point Data” on page 2-19<br />

• “Avoiding Common Problems with Floating-Point Arithmetic” on page 2-21<br />

• “Floating-Point Functions” on page 2-23<br />

• “References” on page 2-23<br />

Double-Precision Floating Point<br />

<strong>MATLAB</strong> constructs the double-precision (or double) data type according<br />

to IEEE Standard 754 for double precision. Any value stored as a double<br />

requires 64 bits, formatted as shown in the table below:<br />

Bits<br />

Usage<br />

63 Sign (0 =positive, 1 =negative)<br />

62 to 52 Exponent, biased by 1023<br />

51 to 0 Fraction f of the number 1.f<br />

2-14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!