% Script roundoff2.m % loss of significance in subtraction % not easy to see the loss os significance in matlab. % To do it convert to base 2 or hex reprentation of IEEE % 0 123456789012 3456789012345678901234567890123456789012345678901234 % s mmmmmmmmmmmm mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm % | | | % | | +--------+ % | 12-bit exponent | % | | % sign bit 52 bit mantissa in 51 bits % the hidden bit is always 1 f1 = @(x) sqrt(1 + x) - 1; num2hex(f1(0.123456789012345E-1)) num2hex(f1(0.123456789012345E-5)) num2hex(f1(0.123456789012345E-10)) num2hex(f1(0.123456789012345E-12)) num2hex(f1(0.123456789012345E-15))