Post Reply 
rskey's Calculator forensics in Fortran
03-13-2016, 02:15 PM
Post: #10
RE: rskey's Calculator forensics in Fortran
(03-08-2016 05:31 PM)Paul Berger (Canada) Wrote:  
Code:
      PROGRAM foren
C       IMPLICIT NONE

       REAL*8  DR, RD, PI

       PI = 3.14159265358979323846264
       DR = PI / 180.0
       RD = 180.0 / PI

       WRITE (*,*) RD * DASIN(RD * DACOS(RD * DATAN(DTAN(DR * DCOS(DR *
     CDSIN(DR * 9.0))))))
      END

Hi Paul,

thanks I have updated the first post with your results. Do you see any difference if you specify double precision constants? The way the code is written it would normally cause standard reals to have to be promoted to REAL*8. For instance 180.0 in double precision in FORTRAN IV thru F90 would probably have to be specified as 180.0D0. I can't remember when KIND came into vogue but I think from F95 something like 180.0_8 would be the way to code it. I have seen accuracy fall off when constants are not declared with the correct precision but your result seems to contradict that. I wonder if there is some default in the compiler you're using that handles that automagically.

It ain't OVER 'till it's 2 PICK
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: rskey's Calculator forensics in Fortran - HP67 - 03-13-2016 02:15 PM



User(s) browsing this thread: 1 Guest(s)