# Apple 1 INTEGER BASIC

If the Apple 1 computer came with INTEGER BASIC, then how am I doing BIORHYTHM?

9000 REM SIN/COS (DEGREES) INPUT A, OUTPUTS S, C
9010 S = ((A MOD 360)+360) MOD 360: REM GET ANGLE 0-359
9020 IF S < 180 THEN 9060
9030 IF S < 270 THEN 9050
9040 C = C5(S-270+1): S =-C5(360-S+1): RETURN: REM 270-359
9050 C =-C5(270-S+1): S =-C5(S-180+1): RETURN: REM 180-269
9060 IF S < 90 THEN 9080
9070 C =-C5(S-90+1): S = C5(180-S+1): RETURN: REM  90-179
9080 C = C5(90-S+1): S = C5(S+1): RETURN: REM   0-089
9800 REM SET UP TABLE
9810 DIM C5(91)
9820 S=0: C=8192
9830 FOR A = 0 TO 45
9840 C5(A+1) = S: C5(90-A+1) = C
9850 S=S+((C/3)*10)/191
9860 C=C-((S/3)*10)/191
9870 NEXT A
9880 RETURN

First I set up an array to hold SIN for 0 to 90 degrees.  (You don’t need more if you know COS is SIN of the angle plus 90, and other quadrants are symmetrical).

But, creating an array of 91 values would pretty much take up all of available programming space, so I generated it using the differential equations — relating SIN and COS.  I also made the values go from 0 to 8192, as going from 0 to 1 is not useful.