software: Added more and more
[pdp8.git] / sw / f4 / FRTSRC / expii.ra
... / ...
CommitLineData
1 SECT #EXPII
2/ B**E
3/ WHERE E IS INTEGER
4/ AND B IS REAL OR INTEGER
5/
6/ VERSION 5A 4/26/77 MH
7/
8 BASE 0
9 JA .
10 FSTA SIGN /SAVE SIGN OF EXPONENT
11 JGE POSINT /ITS POSITIVE
12 FNEG
13POSINT, FSTA 3 /PUT IT INTO 3
14 XTA 1 /SAVE XR 1
15 FSTA XR1
16 LDX -27,1 /BIT COUNT
17 FLDA ONE /START WITH ONE
18 FSTA PROD
19 FLDA 3 /GET EXPONENT
20LOOP, JEQ YES /DONE IF ITS ZERO
21 FDIV TWO /DIVIDE BY TWO
22 ALN 0 /INTEGERIZE
23 FNORM
24 FSTA TEMP /SAVE AT
25 FMUL TWO /IS EXPONENT ODD ?
26 FSUB 3
27 JLT ODD /YES, JUMP
28 FLDA 0 /SQUARE BASE
29SQUARE, FMULM 0
30 FLDA TEMP /EXPONENT OVER 2
31 FSTA 3
32 JXN LOOP,1+ /LOOP IF MORE BITS
33YES, FLDA XR1 /DONE, RESTORE XR 1
34 ATX 1
35 FLDA SIGN /CHECK SIGN OF EXPONENT
36 JLT INVERT /IT WS NEGATIVE, INVERT RESULT
37 FLDA PROD /RETURN ANSWER
38 JA #EXPII
39INVERT, FLDA ONE /RETURN 1/PROD
40 FDIV PROD
41 JA #EXPII
42ODD, FLDA 0 /MULT PROD BY BASE
43 FMULM PROD
44 JA SQUARE /GO SQUARE THE BASE
45ONE, F 1.0
46TWO, F 2.0
47PROD, F 0.0
48SIGN, F 0.0
49TEMP, F 0.0
50XR1, F 0.0
51 END
52\f