Was there a negative real zero possibility in early Fortran?
- From: Terence <tbwright@xxxxxxxxx>
- Date: Tue, 25 Nov 2008 22:04:09 -0800 (PST)
I am revising several programs, (all with at last one similar module,
even if every one differs slightly from every other) and many with
another module, dscussed below, which appears at first to be always
the same code, but isn't so in fact!
The following is a cut-and paste out of one example.
If I had cut another example in the same places, then, where there is
here a
IF(-D) a,b,c
test in one, the other may have
IF(D) c,b,a
Sample (input matrix DATA, real D, integers LCODE and NEWA; output
value real D2)
GOTO (10,20,30,40,50,.etc..),LCODE
C FUNCTION 3
30 IF(-D) 14,99,99
14 D2=ALOG10(D)
GO TO 3
C FUNCTION 4
40 D2=EXP(D)
GO TO 3
C FUNCTION 5
50 IF(-D) 17,7,99
17 IF(D-1.0) 18,19,99
19 D2=3.14159/2.0
GO TO 3
18 D2=ASN(SQRT(D))
GO TO 3
7 D=0.0
GO TO 3
..
3 DATA(I,NEWA)=D2
RETURN
99 (WRITE ERROR MESSAGE)
RETURN
I already have found severe errors; one example is this original code
case corrected by me as above, whose calculated value is lost and
replaced by the previous value of D2!
18 A=SQRT(D)
DATA(I,NEWA)=ASN(A)
GO TO 3
MY QUESTION:
I know this version was written for an IBM 360 in Fortran H (Fortran
IV).
Is there any reason why the programmer is testing (-D) in some cases,
and (D) in others? Is it possible that there was such a thing as
negative real zero?
And this caters for that possibility? Or is the above just an
idiosyncrasy of style?
It worries me that there might be a reason!
.
- Follow-Ups:
- Re: Was there a negative real zero possibility in early Fortran?
- From: Klaus Wacker
- Re: Was there a negative real zero possibility in early Fortran?
- From: dpb
- Re: Was there a negative real zero possibility in early Fortran?
- From: e p chandler
- Re: Was there a negative real zero possibility in early Fortran?
- From: David Flower
- Re: Was there a negative real zero possibility in early Fortran?
- From: Glen Herrmannsfeldt
- Re: Was there a negative real zero possibility in early Fortran?
- From: Glen Herrmannsfeldt
- Re: Was there a negative real zero possibility in early Fortran?
- Prev by Date: Re: Tokyo meeting
- Next by Date: Re: Was there a negative real zero possibility in early Fortran?
- Previous by thread: Compilation Error
- Next by thread: Re: Was there a negative real zero possibility in early Fortran?
- Index(es):
Relevant Pages
|