1 REM Ins{nt av 507 10 REM +++++++++++++++++++++++++++++++++ 20 REM ! Program .... SINCOS 30 REM ! Utg}va 1.1 811215 40 REM ! av (c) Asbj|rn Hamberg 50 REM ! Minne 16 Kbytes 60 REM ! Ins{nt av 507 70 REM +++++++++++++++++++++++++++++++++ 80 REM Detta program ber{knar sinus(A) 90 REM och cosinus(A) med hj{lp av 100 REM serieutveckling. 110 REM Resultatet ger 17 riktiga decimaler. 115 REM ++++++++++++++++++++++++++++++++ 117 ; CHR\$(12) 120 ; "Sinus(A) eller Cosinus(A) (S/C)"; : INPUT F\$ 130 ; "Vilken vinkel i grader"; : INPUT A\$ 140 REM ; "Hur m}nga decimaler i svaret max 17"; : INPUT P 150 ]\$=A\$ 160 P=17 170 IF F\$="C" THEN A\$=SUB\$("90",A\$,20) 180 A\$=MUL\$(A\$,(DIV\$("3.14159265358979323846","180",20)),20) 190 B2\$=MUL\$(A\$,A\$,20) 200 B3\$=MUL\$(A\$,B2\$,20) 210 B4\$=MUL\$(A\$,B3\$,20) 220 B5\$=MUL\$(A\$,B4\$,20) 230 B6\$=MUL\$(A\$,B5\$,20) 240 B7\$=MUL\$(A\$,B6\$,20) 250 B8\$=MUL\$(A\$,B7\$,20) 260 B9\$=MUL\$(A\$,B8\$,20) 270 C1\$=MUL\$(A\$,B9\$,20) 280 C2\$=MUL\$(A\$,C1\$,20) 290 C3\$=MUL\$(A\$,C2\$,20) 300 C4\$=MUL\$(A\$,C3\$,20) 310 C5\$=MUL\$(A\$,C4\$,20) 320 C6\$=MUL\$(A\$,C5\$,20) 330 C7\$=MUL\$(A\$,C6\$,20) 340 C8\$=MUL\$(A\$,C7\$,20) 350 C9\$=MUL\$(A\$,C8\$,20) 360 D1\$=MUL\$(A\$,C9\$,20) 370 D2\$=MUL\$(A\$,D1\$,20) 380 D3\$=MUL\$(A\$,D2\$,20) 390 REM D4\$=MUL\$(A\$,D3\$,20) 400 REM D5\$=MUL\$(A\$,D4\$,20) 410 REM D6\$=MUL\$(A\$,D5\$,20) 420 REM -------------------------------- 430 REM Sum.av 1 : a och 2 : dra termen 440 REM 450 A1\$=SUB\$(A\$,(DIV\$(B3\$,"6",20)),20) 460 REM 470 REM --------------------------------- 480 REM Sum.av 1 : a och 2 : dra 490 REM och 3 : dje termen 500 REM 510 A2\$=ADD\$(A1\$,(DIV\$(B5\$,"120",20)),20) 520 REM -------------------------------- 530 REM Sum.av 4 termer 540 REM 550 A3\$=SUB\$(A2\$,(DIV\$(B7\$,"5040",20)),20) 560 REM -------------------------------- 570 REM Sum.av 5 termer 580 A4\$=ADD\$(A3\$,(DIV\$(B9\$,"362880",20)),20) 590 REM -------------------------------- 600 REM Sum.av 6 termer 610 A5\$=SUB\$(A4\$,(DIV\$(C2\$,"39916800",20)),20) 620 REM -------------------------------- 630 REM Sum.av 7 termer 640 A6\$=ADD\$(A5\$,(DIV\$(C4\$,"6227020800",20)),20) 650 REM -------------------------------- 660 REM Sum.av 8 termer 670 A7\$=SUB\$(A6\$,(DIV\$(C6\$,"1307674368000",20)),20) 680 REM -------------------------------- 690 REM Sum.av 9 termer 700 A8\$=ADD\$(A7\$,(DIV\$(C8\$,"355687428096000",20)),20) 710 REM -------------------------------- 720 A9\$=SUB\$(A8\$,(DIV\$(D1\$,"121645100408832000",20)),20) 730 REM -------------------------------- 740 A9\$=ADD\$(A9\$,(DIV\$(D3\$,"51090942171709440000",20)),P) 750 REM -------------------------------- 760 REM 770 ; CHR\$(12) 780 IF F\$="S" THEN 790 ELSE 820 790 ; "Sinus(";]\$")grader=";A9\$ 800 ; "Fler v{rden?" : GET [\$ 810 IF [\$="J" GOTO 80 820 REM ******* cos a ***************** 830 ; "Cosinus(";]\$")grader=";A9\$ 840 ; "Fler v{rden?" : GET [\$ 850 IF [\$="J" GOTO 80