------- Comment #6 from jvdelisle at gcc dot gnu dot org 2007-05-30 03:37 ------- I modified the program given in comment #4 to display the exact values at the end of the cycle along with the three methods. Method "a" and method "c" give identical results. Method "b" has a different phase and its the end point sooner. The exact true value is shown in the fourth column of the output below.
-- snippet -- a = 3600.0*real(m)+ 60.0*real(l) + real(k) + 0.001*real(j) b = 0.001*real(j) + real(k) + 60.0*real(l) + 3600.0*real(m) c = real(3600*m + 60*l + k) c = c + real(j)/1000.0 exact1 = 3600*m + 60*l + k exact2 = j write(6,100)a, b, c, exact1, exact2 100 format (3(f11.5,2x),i5,".",i3) Result: 86399.98438 86399.98438 86399.98438 86399.988 86399.99219 86399.99219 86399.99219 86399.989 86399.99219 86399.99219 86399.99219 86399.990 86399.99219 86399.99219 86399.99219 86399.991 86399.99219 86399.99219 86399.99219 86399.992 86399.99219 86399.99219 86399.99219 86399.993 86399.99219 86399.99219 86399.99219 86399.994 86399.99219 86399.99219 86399.99219 86399.995 86399.99219 86400.00000 86399.99219 86399.996 86400.00000 86400.00000 86400.00000 86399.997 86400.00000 86400.00000 86400.00000 86399.998 86400.00000 86400.00000 86400.00000 86399.999 a and c are actually a little more accurate at the end. Its also interesting that this deviation between the methods appears to happen only near the end of the sequence. I have visually scanned in quite a few places and all three are identical until this point. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32057