| 1 | / |
| 2 | / |
| 3 | / S I N |
| 4 | / - - - |
| 5 | / |
| 6 | /SUBROUTINE SIN(X) |
| 7 | / |
| 8 | / VERSION 5A 4-27-77 PT |
| 9 | / |
| 10 | SECT SIN |
| 11 | JA #SIN |
| 12 | EXTERN #ARGER |
| 13 | SINER, TRAP4 #ARGER |
| 14 | TEXT +SIN + |
| 15 | SINXR, SETX XRSIN |
| 16 | SETB BPSIN |
| 17 | BPSIN, F 0.0 |
| 18 | XRSIN, F 0.0 |
| 19 | SIN1, F 0.0 |
| 20 | SIN2, F 0.0 |
| 21 | F1SIN, F 1. |
| 22 | FPI2SN, 1 /PI DIVIDED BY 2 |
| 23 | 3110 |
| 24 | 3755 |
| 25 | FPISIN, 2 /PI |
| 26 | 3110 |
| 27 | 3755 |
| 28 | F2PISN, 3 /TWO PI |
| 29 | 3110 |
| 30 | 3755 |
| 31 | ORG 10*3+BPSIN |
| 32 | FNOP |
| 33 | JA SINXR |
| 34 | 0 |
| 35 | SINRTN, JA . |
| 36 | / |
| 37 | SINC9, 7764 |
| 38 | 2501 |
| 39 | 7015 |
| 40 | / |
| 41 | SINC7, 7771 |
| 42 | 5464 |
| 43 | 5515 |
| 44 | / |
| 45 | SINC5, 7775 |
| 46 | 2431 |
| 47 | 5362 |
| 48 | / |
| 49 | SINC3, 0000 |
| 50 | 5325 |
| 51 | 0414 |
| 52 | / |
| 53 | SINTST, 7770 |
| 54 | 2000 |
| 55 | 0000 |
| 56 | BASE 0 |
| 57 | #SIN, STARTD |
| 58 | FLDA 10*3 |
| 59 | FSTA SINRTN |
| 60 | FLDA 0 |
| 61 | SETX XRSIN |
| 62 | SETB BPSIN |
| 63 | BASE BPSIN |
| 64 | LDX 1,1 |
| 65 | FSTA BPSIN |
| 66 | FLDA% BPSIN,1 /ADDR OF X |
| 67 | FSTA BPSIN |
| 68 | STARTF |
| 69 | FLDA% BPSIN /GET X |
| 70 | LDX -1,0 /SET SIGN TO POSITIVE. |
| 71 | JGT SINMOD /IF POSITIVE BYPASS FUDGE. |
| 72 | JEQ SINRTN /IF ZERO EXIT. |
| 73 | FNEG /NEGATIVE. NEGATE AC. SIN(-X)=-SIN(X) |
| 74 | LDX 0,0 /SET SIGN TO MINUS. |
| 75 | SINMOD, JAL SINER /IF SIGN CAN T INT, THEN ERROR. |
| 76 | FDIV F2PISN /REDUCE TO BELOW TWO PI. |
| 77 | FSTA SIN1 /SAVE IN A TEMP. |
| 78 | ALN 0 |
| 79 | FNORM /INTERGIZE IT. |
| 80 | FNEG |
| 81 | FADD SIN1 /RECALL NUMBER. AC NOW <0 |
| 82 | FMUL F2PISN /NOW MULTIPLY BACK. |
| 83 | FSTA SIN2 /AND SAVE AWAY. |
| 84 | FSUB FPISIN /SUBTRACT OFF PI. |
| 85 | JLT SINP /LESS THEN PI. |
| 86 | FSTA SIN2 /RESTORE AS 2. |
| 87 | XTA 0 /INVERT THE SIGN. |
| 88 | FNEG |
| 89 | FSUB F1SIN /SIN(X-PI)=-SIN(X) |
| 90 | ATX 0 /AND PUT BACK. |
| 91 | / |
| 92 | SINP, FLDA SIN2 /RECALL MAGIC GOODY. |
| 93 | FSUB FPI2SN /TEST TO SEE IF X<PI/2 |
| 94 | JLT SINPP /YEP. |
| 95 | / |
| 96 | FLDA FPISIN /SIN(X)=SIN(PI-X) |
| 97 | FSUB SIN2 |
| 98 | FSTA SIN2 /AND STORE IT BACK. |
| 99 | / |
| 100 | SINPP, FLDA SIN2 /GET THE MAGIC NUMBER. |
| 101 | FSUB SINTST /SEE IF ITS CLOSE TO AN EDGE |
| 102 | JGT SINPPP /IT IS NOT |
| 103 | FLDA SIN2 /RECALL NUMBER IF TOO SMALE |
| 104 | JXN SINRTN,0 /EXIT IF SAME SIGN. |
| 105 | FNEG /ELSE NEGATE IT. |
| 106 | JA SINRTN |
| 107 | SINPPP, FLDA SIN2 /RECALL NUMBER TO BE WORKED ON. |
| 108 | FDIV FPI2SN /DIVIDE BY PI OVER TWO. |
| 109 | FSTA SIN2 /AND STORE BACK. |
| 110 | FMUL SIN2 /MULTIPLY OUT. |
| 111 | FSTA SIN1 |
| 112 | FMUL SINC9 /NOW DO THE STANDARD ITERATION. |
| 113 | FADD SINC7 |
| 114 | FMUL SIN1 |
| 115 | FADD SINC5 |
| 116 | FMUL SIN1 |
| 117 | FADD SINC3 |
| 118 | FMUL SIN1 |
| 119 | FADD FPI2SN /ADD IN PI OVER 2 |
| 120 | FMUL SIN2 /DO THE FINAL MULTIPLY. |
| 121 | JXN SINRTN,0 /SHALL WE NEGATE |
| 122 | FNEG /YEP |
| 123 | JA SINRTN /AND RETURN. |
| 124 | \f |