Geoscience Reference
In-Depth Information
h e value of 3 occurs twice in A and the number of elements in N is therefore
one less than in A .
2.5 Data Structures and Classes of Objects
h e default data type or class in MATLAB is double precision or double , which
stores data in a 64-bit array of l oating-point numbers. Such l oating-point
numbers are approximations of real numbers that allow a maximum range
of values in a limited numbers of bits. A double-precision array allows the
sign of a number to be stored (bit 63), together with the exponent (bits 62 to
52), and roughly 16 signii cant decimal digits (bits 51 to 0). Typing
clear
realmin('double')
realmax('double')
yields the smallest and largest positive l oating-point number in double
precision
ans =
2.2251e-308
ans =
1.7977e+308
h e actual number of l oating point numbers is therefore limited by the
number of bits available, in contrast to real numbers. h e dif erence between
1.0 and the next largest double-precision number can be calculated using the
l oating-point relative accuracy eps by typing
eps(1.0)
which yields
ans =
2.2204e-16
h e round-of error depends on the value of the real number; it is, for
example, dif erent for 5.0, as we can see by typing
eps(5.0)
which yields
ans =
8.8818e-16
Search WWH ::




Custom Search