R1MACH
Return to Main Software Page
C
C----------------------------------------------------------------------
C FUNCTION: R1MACH
C THIS ROUTINE IS FROM THE PORT MATHEMATICAL SUBROUTINE LIBRARY
C IT IS DESCRIBED IN THE BELL LABORATORIES COMPUTING SCIENCE
C TECHNICAL REPORT #47 BY P.A. FOX, A.D. HALL AND N.L. SCHRYER
C A MODIFICATION TO THE "I OUT OF BOUNDS" ERROR MESSAGE
C HAS BEEN MADE BY C. A. MCGONEGAL - APRIL, 1978
C----------------------------------------------------------------------
C
REAL FUNCTION R1MACH(I)
C
C SINGLE-PRECISION MACHINE CONSTANTS
C
C R1MACH(1) = B**(EMIN-1), THE SMALLEST POSITIVE MAGNITUDE.
C
C R1MACH(2) = B**EMAX*(1 - B**(-T)), THE LARGEST MAGNITUDE.
C
C R1MACH(3) = B**(-T), THE SMALLEST RELATIVE SPACING.
C
C R1MACH(4) = B**(1-T), THE LARGEST RELATIVE SPACING.
C
C R1MACH(5) = LOG10(B)
C
C TO ALTER THIS FUNCTION FOR A PARTICULAR ENVIRONMENT,
C THE DESIRED SET OF DATA STATEMENTS SHOULD BE ACTIVATED BY
C REMOVING THE C FROM COLUMN 1.
C
C WHERE POSSIBLE, OCTAL OR HEXADECIMAL CONSTANTS HAVE BEEN USED
C TO SPECIFY THE CONSTANTS EXACTLY WHICH HAS IN SOME CASES
C REQUIRED THE USE OF EQUIVALENT INTEGER ARRAYS.
C
INTEGER SMALL(2)
INTEGER LARGE(2)
INTEGER RIGHT(2)
INTEGER DIVER(2)
INTEGER LOG10(2)
C
REAL RMACH(5)
C
EQUIVALENCE (RMACH(1),SMALL(1))
EQUIVALENCE (RMACH(2),LARGE(1))
EQUIVALENCE (RMACH(3),RIGHT(1))
EQUIVALENCE (RMACH(4),DIVER(1))
EQUIVALENCE (RMACH(5),LOG10(1))
C
C MACHINE CONSTANTS FOR THE BURROUGHS 1700 SYSTEM.
C
C DATA RMACH(1) / Z400800000 /
C DATA RMACH(2) / Z5FFFFFFFF /
C DATA RMACH(3) / Z4E9800000 /
C DATA RMACH(4) / Z4EA800000 /
C DATA RMACH(5) / Z500E730E8 /
C
C MACHINE CONSTANTS FOR THE BURROUGHS 5700/6700/7700 SYSTEMS.
C
C DATA RMACH(1) / O1771000000000000 /
C DATA RMACH(2) / O0777777777777777 /
C DATA RMACH(3) / O1311000000000000 /
C DATA RMACH(4) / O1301000000000000 /
C DATA RMACH(5) / O1157163034761675 /
C
C MACHINE CONSTANTS FOR THE CDC 6000/7000 SERIES.
C
C DATA RMACH(1) / 00014000000000000000B /
C DATA RMACH(2) / 37767777777777777777B /
C DATA RMACH(3) / 16404000000000000000B /
C DATA RMACH(4) / 16414000000000000000B /
C DATA RMACH(5) / 17164642023241175720B /
C
C MACHINE CONSTANTS FOR THE CRAY 1
C
C DATA RMACH(1) / 200004000000000000000B /
C DATA RMACH(2) / 577767777777777777776B /
C DATA RMACH(3) / 377224000000000000000B /
C DATA RMACH(4) / 377234000000000000000B /
C DATA RMACH(5) / 377774642023241175720B /
C
C MACHINE CONSTANTS FOR THE DATA GENERAL ECLIPSE S/200
C
C NOTE - IT MAY BE APPROPRIATE TO INCLUDE THE FOLLOWING CARD -
C STATIC RMACH(5)
C
C DATA SMALL/20K,0/,LARGE/77777K,177777K/
C DATA RIGHT/35420K,0/,DIVER/36020K,0/
C DATA LOG10/40423K,42023K/
C
C MACHINE CONSTANTS FOR THE HARRIS SLASH 6 AND SLASH 7
C
C DATA SMALL(1),SMALL(2) / '20000000, '00000201 /
C DATA LARGE(1),LARGE(2) / '37777777, '00000177 /
C DATA RIGHT(1),RIGHT(2) / '20000000, '00000352 /
C DATA DIVER(1),DIVER(2) / '20000000, '00000353 /
C DATA LOG10(1),LOG10(2) / '23210115, '00000377 /
C
C MACHINE CONSTANTS FOR THE HONEYWELL 600/6000 SERIES.
C
C DATA RMACH(1) / O402400000000 /
C DATA RMACH(2) / O376777777777 /
C DATA RMACH(3) / O714400000000 /
C DATA RMACH(4) / O716400000000 /
C DATA RMACH(5) / O776464202324 /
C
C MACHINE CONSTANTS FOR THE IBM 360/370 SERIES,
C THE XEROX SIGMA 5/7/9 AND THE SEL SYSTEMS 85/86.
C
C DATA RMACH(1) / Z00100000 /
C DATA RMACH(2) / Z7FFFFFFF /
C DATA RMACH(3) / Z3B100000 /
C DATA RMACH(4) / Z3C100000 /
C DATA RMACH(5) / Z41134413 /
C
C MACHINE CONSTANTS FOR THE PDP-10 (KA OR KI PROCESSOR).
C
C DATA RMACH(1) / "000400000000 /
C DATA RMACH(2) / "377777777777 /
C DATA RMACH(3) / "146400000000 /
C DATA RMACH(4) / "147400000000 /
C DATA RMACH(5) / "177464202324 /
C
C MACHINE CONSTANTS FOR PDP-11 FORTRAN'S SUPPORTING
C 32-BIT INTEGERS (EXPRESSED IN INTEGER AND OCTAL).
C
C DATA SMALL(1) / 8388608 /
C DATA LARGE(1) / 2147483647 /
C DATA RIGHT(1) / 880803840 /
C DATA DIVER(1) / 889192448 /
C DATA LOG10(1) / 1067065499 /
C
C DATA RMACH(1) / O00040000000 /
C DATA RMACH(2) / O17777777777 /
C DATA RMACH(3) / O06440000000 /
C DATA RMACH(4) / O06500000000 /
C DATA RMACH(5) / O07746420233 /
C
C MACHINE CONSTANTS FOR PDP-11 FORTRAN'S SUPPORTING
C 16-BIT INTEGERS (EXPRESSED IN INTEGER AND OCTAL).
C
C DATA SMALL(1),SMALL(2) / 128, 0 /
C DATA LARGE(1),LARGE(2) / 32767, -1 /
C DATA RIGHT(1),RIGHT(2) / 13440, 0 /
C DATA DIVER(1),DIVER(2) / 13568, 0 /
C DATA LOG10(1),LOG10(2) / 16282, 8347 /
C
C DATA SMALL(1),SMALL(2) / O000200, O000000 /
C DATA LARGE(1),LARGE(2) / O077777, O177777 /
C DATA RIGHT(1),RIGHT(2) / O032200, O000000 /
C DATA DIVER(1),DIVER(2) / O032400, O000000 /
C DATA LOG10(1),LOG10(2) / O037632, O020233 /
C
C MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES.
C
C DATA RMACH(1) / O000400000000 /
C DATA RMACH(2) / O377777777777 /
C DATA RMACH(3) / O146400000000 /
C DATA RMACH(4) / O147400000000 /
C DATA RMACH(5) / O177464202324 /
C
C MACHINE CONSTANTS FOR THE VAX-11 WITH
C FORTRAN IV-PLUS COMPILER
C
C DATA RMACH(1) / Z00000080 /
C DATA RMACH(2) / ZFFFF7FFF /
C DATA RMACH(3) / Z00003480 /
C DATA RMACH(4) / Z00003500 /
C DATA RMACH(5) / Z209B3F9A /
C
IF (I .LT. 1 .OR. I .GT. 5) GOTO 100
C
R1MACH = RMACH(I)
RETURN
C
100 IWUNIT = I1MACH(4)
WRITE(IWUNIT, 99)
99 FORMAT(25H R1MACH - I OUT OF BOUNDS)
STOP
END
Return to Main Software Page