% Script File: Dot3Hist % Histogram of 3-digit floating point error % in computing 5-tuple dot products. close all x = randn(5,100); y = randn(5,100); er = zeros(100,1); for k = 1:100 er(k) = x(k)'*y(k)-Dot3(x(k),y(k)); end hist(er,20) % axis([-1 1 0 100]) title('Errors arising in 3-digit base-10 floating point calculations') xlabel(sprintf('Mean = %5.3f. Median = %5.3f.',mean(er),median(er)))