Following is an example of how arithmetic results can vary on computers, even though all are using IEEE arithmetic. PROGRAM #1 INTEGER N,LP,J REAL XFIRST,XFAC,X,FA,FB DOUBLE PRECISION DX,DF,ERRFA,ERRFB,RERRFA,RERRFB N=10 XFIRST=1.0 XFAC=9.9 LP=6 WRITE(LP,10) 10 FORMAT('1') X=XFIRST DO 100 J=1,N FA=ALOG(X+1) - ALOG(X) FB=ALOG(1 + 1/X) DX=X DF=DLOG(1 + 1/DX) ERRFA=DF-FA ERRFB=DF-FB RERRFA=ERRFA/DF RERRFB=ERRFB/DF WRITE(LP,20)J,X,FA,FB,DF,RERRFA,RERRFB 20 FORMAT(/,' J=',I2,5X,'X =',1PG15.7,/,2X,'FA =',1PD15.7,5X, * 'FB =',G15.7,5X,'DF =',G25.17,/,2X,'RERRFA =',1PG15.7, * 5X,'RERRFB =',G15.7) X=X*XFAC 100 CONTINUE STOP END Output when using the Microsoft Fortran compiler on a Pentium PC. J= 1 X = 1.000000 FA = 6.9314720D-01 FB = .6931472 DF = .69314718055994530 RERRFA = -2.7478353E-09 RERRFB = -2.7478353E-09 J= 2 X = 9.900000 FA = 9.6228030D-02 FB = 9.6228030E-02 DF = 9.62280356296269000E-02 RERRFA = 2.4165644E-08 RERRFB = 2.4165644E-08 J= 3 X = 98.00999 FA = 1.0151340D-02 FB = 1.0151340E-02 DF = 1.01513414194087200E-02 RERRFA = -1.3603525E-08 RERRFB = -1.3603525E-08 J= 4 X = 970.2989 FA = 1.0300800D-03 FB = 1.0300800E-03 DF = 1.03007955570189700E-03 RERRFA = 9.0816380E-10 RERRFB = 9.0816370E-10 J= 5 X = 9605.959 FA = 1.0409660D-04 FB = 1.0409660E-04 DF = 1.04096629416678800E-04 RERRFA = -1.3490597E-08 RERRFB = -1.3490597E-08 J= 6 X = 95098.99 FA = 1.0515300D-05 FB = 1.0515300E-05 DF = 1.05153032577460600E-05 RERRFA = 1.7426734E-08 RERRFB = 1.7426734E-08 J= 7 X = 941480.0 FA = 1.0621570D-06 FB = 1.0621570E-06 DF = 1.06215689013218900E-06 RERRFA = -2.0359793E-08 RERRFB = -2.0359793E-08 J= 8 X = 9320652. FA = 1.0728860D-07 FB = 1.0728860E-07 DF = 1.07288625984019400E-07 RERRFA = -1.6551171E-08 RERRFB = -1.6551171E-08 J= 9 X = 9.2274450E+07 FA = 1.0837240D-08 FB = 1.0837240E-08 DF = 1.08372362691186500E-08 RERRFA = 2.5064837E-08 RERRFB = 2.5064837E-08 J=10 X = 9.1351700E+08 FA = 1.0946700D-09 FB = 1.0946700E-09 DF = 1.09467038726508800E-09 RERRFA = 3.0057171E-08 RERRFB = 3.0057172E-08 PROGRAM #2 INTEGER N,LP,J REAL XFIRST,XFAC,X,FA,FB DOUBLE PRECISION DX,DF,ERRFA,ERRFB,RERRFA,RERRFB,DU N=10 XFIRST=1.0 XFAC=9.9 LP=6 WRITE(LP,10) 10 FORMAT('1') X=XFIRST DO 100 J=1,N C C NOTE THE CHANGE IN THE COMPUTATION OF LOG(X+1)-LOG(X) U=1+1/X FA1=ALOG(X+1) FA2=ALOG(X) FA=FA1-FA2 FB=ALOG(U) DU=U DF=DLOG(DU) ERRFA=DF-FA ERRFB=DF-FB RERRFA=ERRFA/DF RERRFB=ERRFB/DF WRITE(LP,20)J,X,FA,FB,DF,RERRFA,RERRFB 20 FORMAT(/,' J=',I2,5X,'X =',1PG15.7,/,2X,'FA =',1PD15.7,5X, * 'FB =',G15.7,5X,'DF =',G25.17,/,5X,'RERRFA =',1PG15.7, * 5X,'RERRFB =',G15.7) X=X*XFAC 100 CONTINUE PAUSE STOP END Output when using the Microsoft Fortran compiler on a Pentium PC. J= 1 X = 1.000000 FA = 6.9314720D-01 FB = .6931472 DF = .69314718055994530 RERRFA = -2.7478353E-09 RERRFB = -2.7478353E-09 J= 2 X = 9.900000 FA = 9.6228000D-02 FB = 9.6228030E-02 DF = 9.62280356296269000E-02 RERRFA = 4.1129714E-07 RERRFB = 2.4165644E-08 J= 3 X = 98.00999 FA = 1.0151110D-02 FB = 1.0151340E-02 DF = 1.01513414194087200E-02 RERRFA = 2.3014089E-05 RERRFB = -1.3603525E-08 J= 4 X = 970.2989 FA = 1.0302960D-03 FB = 1.0300800E-03 DF = 1.03007955570189700E-03 RERRFA = -2.0975652E-04 RERRFB = 9.0816370E-10 J= 5 X = 9605.959 FA = 1.0435080D-04 FB = 1.0409660E-04 DF = 1.04096629416678800E-04 RERRFA = -2.4419067E-03 RERRFB = -1.3490597E-08 J= 6 X = 95098.99 FA = 1.0980270D-05 FB = 1.0515300E-05 DF = 1.05153032577460600E-05 RERRFA = -4.4217881E-02 RERRFB = 1.7426734E-08 J= 7 X = 941480.0 FA = 1.5386350D-06 FB = 1.0621570E-06 DF = 1.06215689013218900E-06 RERRFA = -.4485945 RERRFB = -2.0359793E-08 J= 8 X = 9320652. FA = -2.9766850D-07 FB = 1.0728860E-07 DF = 1.07288625984019400E-07 RERRFA = 3.774465 RERRFB = -1.6551171E-08 J= 9 X = 9.2274450E+07 FA = 8.0074450D-07 FB = 1.0837240E-08 DF = 1.08372362691186500E-08 RERRFA = -72.88826 RERRFB = 2.5064837E-08 J=10 X = 9.1351700E+08 FA = -3.4594560D-08 FB = 1.0946700E-09 DF = 1.09467038726508800E-09 RERRFA = 32.60272 RERRFB = 3.0057172E-08 Output when running program #1 with a fortran compiler on an HP-720 workstation J= 1 X = 1.000000 FA = 6.9314718D-01 FB = .6931472 DF = .69314718055994528 RERRFA = -2.7478353E-09 RERRFB = -2.7478353E-09 J= 2 X = 9.900000 FA = 9.6227884D-02 FB = 9.6228018E-02 DF = 9.62280356296269250E-02 RERRFA = 1.5726916E-06 RERRFB = 1.7901824E-07 J= 3 X = 98.00999 FA = 1.0150909D-02 FB = 1.0151304E-02 DF = 1.01513414194086770E-02 RERRFA = 4.2555517E-05 RERRFB = 3.6561482E-06 J= 4 X = 970.2989 FA = 1.0304451D-03 FB = 1.0300337E-03 DF = 1.03007955570179540E-03 RERRFA = -3.5486888E-04 RERRFB = 4.4529155E-05 J= 5 X = 9605.959 FA = 1.0395050D-04 FB = 1.0406430E-04 DF = 1.04096629416738390E-04 RERRFA = 1.4037816E-03 RERRFB = 3.1060517E-04 J= 6 X = 95098.99 FA = 1.1444092D-05 FB = 1.0490363E-05 DF = 1.05153032576883780E-05 RERRFA = -8.8327318E-02 RERRFB = 2.3718143E-03 J= 7 X = 941480.0 FA = 1.9073486D-06 FB = 1.0728830E-06 DF = 1.06215689012362410E-06 RERRFA = -.7957315 RERRFB = -1.0098459E-02 J= 8 X = 9320652. FA = .0000000D+00 FB = 1.1920928E-07 DF = 1.07288626001149800E-07 RERRFA = 1.000000 RERRFB = -.1111083 J= 9 X = 9.2274448E+07 FA = .0000000D+00 FB = .0000000E+00 DF = 1.08372361608068570E-08 RERRFA = 1.000000 RERRFB = 1.000000 J=10 X = 9.1351699E+08 FA = .0000000D+00 FB = .0000000E+00 DF = 1.09467035376324110E-09 RERRFA = 1.000000 RERRFB = 1.000000