%% Double-Precision Versus Single-Precision
% Compare the ranges of numeric values in double-precision to the ranges for single-precision.
% Use the realmin and realmax functions to display the minimum and maximum positives values that can be represented in double precision.

doublemin = realmin('double')
doublemax = realmax('double')

%
% Now display the  minimum and maximum positive values that can be represented in single precision. The range of values is smaller compared to double-precision, but requires less memory.

singlemin = realmin('single')
singlemax = realmax('single')

%
% The eps function returns a measure of how close numbers can be in double-precision versus single-precision. Display the distance from the number 1.0 to the next larger double-precision number.

doubleeps = eps('double')

% Now display the distance from 1.0 to the next larger single-precision number. Double-precision values are closer to each other, since you can represent more of them.

singleeps = eps('single')

% Copyright 2019 The MathWorks, Inc.