Post Reply 
rskey's Calculator forensics in Fortran
06-30-2014, 12:44 PM (This post was last modified: 03-13-2016 02:11 PM by HP67.)
Post: #1
rskey's Calculator forensics in Fortran
This page http://www.rskey.org/~mwsebastian/miscprj/radians.htm made me wonder what the various versions of Fortran I have would produce for the calculator forensics test. Using the info there as a basic guide I prepared this small piece of Fortran code:

Code:
PROGRAM foren
  IMPLICIT NONE
  REAL(8) :: PI = 3.14159265358979323846264_8
  REAL(8) :: DR, RD

  DR = PI / 180.0_8
  RD = 180.0_8 / PI

  WRITE (*,*) RD * ASIN(RD * ACOS(RD * ATAN(TAN(DR * COS(DR * SIN(DR * 9.0_8))))))
END PROGRAM foren

For VAX/VMS I used this piece of F66-conforming code for the F77 compiler:

Code:

C
C RSKEY FORENSICS
C
      REAL*8 PI /3.14159265358979323846264D0/
      REAL*8 DR, RD, RESULT
C
      DR = PI / 180.0D0
      RD = 180.0D0 / PI
C
      RESULT = RD * DASIN(RD * DACOS(RD * DATAN(DTAN(DR * 
     X        DCOS(DR * DSIN(DR * 9.0D0))))))
C
      WRITE (6,100) RESULT
  100 FORMAT (' ',F17.15)
      STOP
      END

For IBM OS/360 FORTRAN G & H I used this piece of FORTRAN IV code which is very similar to the VAX code except I had to use the FORTRAN IV function subroutine names for two trig functions whereas on the VAX the F77 compiler was able to either find the right function or use the one from F66, however it is implemented.

Code:

C
C RSKEY FORENSICS
C
      REAL*8 PI /3.14159265358979323846264D0/
      REAL*8 DR, RD, RESULT
C
      DR = PI / 180.0D0
      RD = 180.0D0 / PI
C
      RESULT = RD * DARSIN(RD * DARCOS(RD * DATAN(DTAN(DR *
     X         DCOS(DR * DSIN(DR * 9.0D0))))))
C
      WRITE (6,100) RESULT
  100 FORMAT (' ',F17.15)
      STOP
      END


Here are the results with the Fortran compilers I have: Sorry for the bad alignment. For whatever reason code tags don't help much and I can't set the font to a fixed with font so although it looks almost correct in preview/posting mode once it is posted it doesn't.

Code:

g95              8.999999999967708
gfortran        8.9999999998325695
ifort             8.99999999983257
OpenUH        8.99999999983257
Open64         8.99999999983257
Solaris Studio 8.999999999832553
VMS/VAX       8.999999999984616
IBM G&H        8.999999999967723
MS compiler V3.2 8.99999999989670 [Thanks to Paul Berger]

This is the version info for the various compilers:

Code:

g95 --version
G95 (GCC 4.0.3 (g95 0.94!) Jan 17 2013)
Copyright (C) 2002-2008 Free Software Foundation, Inc.

gfortran --version
GNU Fortran (GCC) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.

ifort --version
ifort (IFORT) 13.1.1 20130313
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

openf95 --version
OpenUH 3.0.29 (based on Open64 Compiler Suite: Version 5.0)
Built on: 2013-06-14 15:03:42 -0500
Thread model: posix
Configured with --prefix=/opt/openuh/3.0.29 --enable-coarrays --enable-dragon-support --disable-caf-runtime
GNU gcc version 4.2.0 (Open64 5.0 driver)

openf95 --version
Open64 Compiler Suite: Version 5.0
Built on: 2011-11-09 11:16:36 +0800
Thread model: posix
GNU gcc version 4.2.0 (Open64 5.0 driver)

f95 -V
f90: Sun Fortran 95 8.6 Linux_i386 2011/11/16

(DEC VAX/VMS) Compaq Fortran 77 V6.6-201

(IBM) FORTRAN IV G LEVEL  21

(IBM) LEVEL 21.8 ( JUN 74 ) OS/360  FORTRAN H

I don't know what I expected to find but I was surprised to see that Intel's Fortran produces the same results as the open64 suite. I have not benchmarked big programs but Intel's compiler is supposedly to beat anything else pretty consistently for runtimes on Intel hardware. If that is true then it means they really did some important work on the base open64 code.

I have other compilers on other hardware platforms. I'll add the info to this thread when I get a chance.


The only thing I have left is for SOLARIS SPARC. Will possibly update that later.

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
rskey's Calculator forensics in Fortran - HP67 - 06-30-2014 12:44 PM



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