{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

16_pdfsam_2

# 16_pdfsam_2 - > z = x*y z= 0 Here z should have been...

This preview shows page 1. Sign up to view the full content.

>> z = x*y z = 0 Here z should have been 2.5e-400 , but due to exponent underﬂow, the result is displayed as 0. Due to the finite accuracy of the representation of numbers in a computer, errors can be made in computations. For example, we know that 1 5 × 0 . 2 = 0; however, Matlab produces the following: >> 1 -0.2 -0.2 -0.2 -0.2 -0.2 ans = 5.5511e-017 The result is a very small number, but it is not exactly zero. The reason is that the binary number corresponding to 0.2 is 0 . 001100110011001100 . . . This representation requires an infinite number of digits. The consequence is that the computer works with an approximate value of 0.2. Subtracting the approximate value of 0.2 from 1 five times does not yield exactly 0. 2.5 Display Options There are several ways to display the value of a variable. The simplest way is to enter the name of
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online