This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Tests for fortran intrinsic functions
- To: "'egcs at egcs dot cygnus dot com'" <egcs at egcs dot cygnus dot com>
- Subject: Tests for fortran intrinsic functions
- From: "Billinghurst, David (RTD)" <David dot Billinghurst at riotinto dot com dot au>
- Date: Thu, 17 Dec 1998 05:53:27 -0000
The g77 test suite looked a little bare.
I thought I might write a few tests for intrinsic functions.
Before I put any effort into it:
o Has it been done before?
o Any comments on the sample below?
+++++++++++++++++++++++++++++++++++++++++
(Mr) David Billinghurst
Comalco Research Centre
PO Box 316, Thomastown, Vic, Australia, 3074
Phone: +61 3 9469 0642
FAX: +61 3 9462 2700
E-mail: David.Billinghurst@riotinto.com.au
----------------------------------------------------------------------------
-------------------------------------------
program test_sin
* Test SIN intrinsic function
* Ref: ISO/IEC 1539: 1991 Section 13.13.97
*
* Not fanatical about precision or behavior for complex args.
*
* David Billinghurst (David.Billinghurst@riotinto.com.au)
* December 1998
IMPLICIT NONE
INTEGER I, NREAL, N
PARAMETER( NREAL = 6 )
PARAMETER( N = 7 )
COMPLEX*16 X(N), A(N)
REAL SX, SA, S, STOL
DOUBLE PRECISION DX, DA, D, DTOL
COMPLEX CX, CA, C
COMPLEX*16 ZX, ZA, Z
*
PARAMETER( STOL = 1.0D-6 )
PARAMETER( DTOL = 1.0D-14 )
* Note that X and A are COMPLEX*16
X(1) = 0.0D0
A(1) = 0.0D0
X(2) = 0.25D0
A(2) = 0.247403959254522929596D0
X(3) = 0.5D0
A(3) = 0.479425538604203000273D0
X(4) = 1.0D0
A(4) = 0.841470984807896506652D0
X(5) = 1.6D0
A(5) = 0.999573603041505164342D0
X(6) = 50.0D0
A(6) = -0.262374853703928785914D0
X(7) = (1.0D0, 1.0D0)
A(7) = (1.298457581415977294826D0,0.634963914784736108255D0)
* Single precision real
DO I = 1, NREAL
SX = X(I)
SA = A(I)
S = SIN(SX)
IF ( ABS(SA-S) .GT. STOL ) THEN
WRITE(6,*) 'Single precision failure'
WRITE(6,*) SX, SA, S, SA-S
CALL ABORT
END IF
END DO
* Double precision real
DO I = 1, NREAL
DX = X(I)
DA = A(I)
D = SIN(DX)
IF ( ABS(DA-D) .GT. DTOL ) THEN
WRITE(6,*) 'Double precision failure'
WRITE(6,*) DX, DA, D, DA-D
CALL ABORT
END IF
END DO
* Single precision complex
DO I = 1, N
CX = X(I)
CA = A(I)
C = SIN(CX)
IF ( ABS(CA-C) .GT. STOL ) THEN
WRITE(6,*) 'Single precision complex failure'
WRITE(6,*) CX, CA, C, CA-C
CALL ABORT
END IF
END DO
* Double precision complex
DO I = 1, N
ZX = X(I)
ZA = A(I)
Z = SIN(ZX)
IF ( ABS(ZA-Z) .GT. DTOL ) THEN
WRITE(6,*) 'Double precision complex failure'
WRITE(6,*) ZX, ZA, Z, ZA-Z
CALL ABORT
END IF
END DO
END