Lesson topics
Demo 6
program demo6
c This program demonstrates base 2 conversion round-off error.
c For x and y, single precision round-off error occurs at the
c 9th digit. For z, double precision round-off error does not
c occur until the 17th digit. Although y is a double precision
c variable, its value is prescribed only in single precision,
c and so double precision is lost.
real x
double precision y, z
x = 1.1
y = 1.1
z = 1.1D0
print *, "x = ", x
print *, "y = ", y
print *, "z = ", z
write (*,5) "More precisely, x, y, z have the values ", x, y, z
5 format (a,/,3f20.16)
end