Floating point math in FORTRAN IV on PDP-8
Jonathan Engwall
engwalljonathanthereal at gmail.com
Thu Sep 20 16:51:41 CDT 2018
My SIMH resists anything but Adventure, I am working through a Fortran IV. I think you break from the loop and confuse the machine using i. That with some error checking:
.TYPE FLOAT.FT
DO 50 X=1,100
F = FLOAT(X)
G = SQRT(F)
IF (G) (11,11,90)
11 WRITE(4,75) G
75 FORMAT(H 5,ERROR)
90 H = ALOG(F)
WRITE(4,99) F,G,H
99 FORMAT(' ',E12.6,E12.6,E12.6)
50 CONTINUE
WRITE(4,100) F,G,H
100 FORMAT(' ',E12.6,E12.6,E12.6)
END
My for fortran IV book and I are the same age,LoL
Jonathan Engwall
engwalljonathanthereal at gmail.com
On September 19, 2018, at 11:10 PM, mark--- via cctalk <cctalk at classiccmp.org> wrote:
Hi Kyle
Just out of interest I ran this on VAX Fortran (Compaq Fortran 77 6.6-201) and I think got the results expected:
$ type for004.dat
1.000000 1.000000 0.000000
2.000000 1.414214 0.693147
3.000000 1.732051 1.098612
4.000000 2.000000 1.386294
5.000000 2.236068 1.609438
...
98.000000 9.899495 4.584968
99.000000 9.949874 4.595120
100.000000 10.000000 4.605170
However, I am no Fortran expert!
Regards, Mark.
-----Original Message-----
From: cctalk <cctalk-bounces at classiccmp.org> On Behalf Of Kyle Owen via cctalk
Sent: Wednesday, September 19, 2018 11:44 PM
To: General Discussion: On-Topic and Off-Topic Posts <cctalk at classiccmp.org>
Subject: Floating point math in FORTRAN IV on PDP-8
At VCF MW this past weekend, I was playing around with an FPP8/A stuffed into a PDP-8/M with a fan removed. This hex-wide two-board set will happily work in a quad-wide backplane, as it needs no signals that an 8/A would otherwise provide.
I wanted to benchmark the FPP8/A with the software emulation that FORTRAN IV supposedly does. Mind you, I also don't have an EAE in mine, so software emulation for integer multiplication/division would also be used.
I tried running a simple program to print some natural logs and square roots, which ran quite well with the FPP8/A in place.
Without the FPP8/A...all of the results were wrong. Significantly. Negative numbers in many cases. No clear pattern as to what it's doing.
Would anyone be able to try my program on some other real hardware (or another emulator) to verify? With and without EAE would also be desirable.
I'm not sure how to disable the EAE in SIMH, else I'd try that too.
Here's what SIMH looks like with my program:
PDP-8 simulator V4.0-0 Current git commit id: d35b8725
sim> at rk0 disk2.fortran.rk05
sim> b rk
.TYPE FLOAT.FT
DO 50 I=1,100
F = FLOAT(I)
G = SQRT(F)
H = ALOG(F)
WRITE(4,100) F,G,H
50 CONTINUE
100 FORMAT(' ',F12.6,F12.6,F12.6)
END
.R F4
*FLOAT/G$
1.000002 1.000002 0.000000
2.000002 1.414215 0.693147
3.000002 1.732053 1.098614
4.000002 2.000002 1.386296
5.000002 2.236070 1.609439
[snip]
98.000001 9.899495 4.584968
99.000000 9.949874 4.595121
100.000023 10.000008 4.605171
.
Much appreciated,
Kyle
More information about the cctalk
mailing list