Home » Archimedes archive » Acorn User » AU 1994-08.adf » !StarInfo_StarInfo » Vlietinck/CosSinBas
Vlietinck/CosSinBas
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1994-08.adf » !StarInfo_StarInfo |
Filename: | Vlietinck/CosSinBas |
Read OK: | ✔ |
File size: | 01BE bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM >CosSinBas 20REM by Jan Vlietinck 30REM (c) AU August 1994 40 50K=0.607252935 60REPEAT 70 INPUT '"Angle h in degrees abs(h)< 90� ",H:H=RADH 80 O=H 90 X=K:Y=0 100 FOR I=0 TO 16 110 T=X-SGN(H)*Y*2^(-I) 120 Y=Y+SGN(H)*X*2^(-I) 130 X=T 140 H=H-SGN(H)*ATN(2^(-I)) 150 NEXT 160 T=X-H*Y:REM linear interpolation 170 Y=Y+H*X 180 X=T 190 PRINT '"Using CORDIC" 200 PRINT "cos(h)= ";X 210 PRINT "sin(h)= ";Y 220 PRINT '"Using BASIC" 230 PRINT "cos(h)= ";COSO 240 PRINT "sin(h)= ";SINO 250UNTIL FALSE
� >CosSinBas � by Jan Vlietinck � (c) AU August 1994 ( 2K=0.607252935 <� F0 � '"Angle h in degrees abs(h)< 90� ",H:H=�H P O=H Z X=K:Y=0 d � I=0 � 16 n T=X-�(H)*Y*2^(-I) x Y=Y+�(H)*X*2^(-I) � X=T � H=H-�(H)*�(2^(-I)) � � �# T=X-H*Y:� linear interpolation � Y=Y+H*X � X=T � � '"Using CORDIC" � � "cos(h)= ";X � � "sin(h)= ";Y � � '"Using BASIC" � � "cos(h)= ";�O � � "sin(h)= ";�O �� � �
00000000 0d 00 0a 14 f4 20 20 20 20 20 3e 43 6f 73 53 69 |..... >CosSi| 00000010 6e 42 61 73 0d 00 14 17 f4 20 62 79 20 20 4a 61 |nBas..... by Ja| 00000020 6e 20 56 6c 69 65 74 69 6e 63 6b 0d 00 1e 18 f4 |n Vlietinck.....| 00000030 20 28 63 29 20 41 55 20 41 75 67 75 73 74 20 31 | (c) AU August 1| 00000040 39 39 34 0d 00 28 04 0d 00 32 11 4b 3d 30 2e 36 |994..(...2.K=0.6| 00000050 30 37 32 35 32 39 33 35 0d 00 3c 05 f5 0d 00 46 |07252935..<....F| 00000060 30 20 e8 20 27 22 41 6e 67 6c 65 20 68 20 69 6e |0 . '"Angle h in| 00000070 20 64 65 67 72 65 65 73 20 61 62 73 28 68 29 3c | degrees abs(h)<| 00000080 20 39 30 b0 20 22 2c 48 3a 48 3d b2 48 0d 00 50 | 90. ",H:H=.H..P| 00000090 08 20 4f 3d 48 0d 00 5a 0c 20 58 3d 4b 3a 59 3d |. O=H..Z. X=K:Y=| 000000a0 30 0d 00 64 0f 20 e3 20 49 3d 30 20 b8 20 31 36 |0..d. . I=0 . 16| 000000b0 0d 00 6e 17 20 20 54 3d 58 2d b4 28 48 29 2a 59 |..n. T=X-.(H)*Y| 000000c0 2a 32 5e 28 2d 49 29 0d 00 78 17 20 20 59 3d 59 |*2^(-I)..x. Y=Y| 000000d0 2b b4 28 48 29 2a 58 2a 32 5e 28 2d 49 29 0d 00 |+.(H)*X*2^(-I)..| 000000e0 82 09 20 20 58 3d 54 0d 00 8c 18 20 20 48 3d 48 |.. X=T.... H=H| 000000f0 2d b4 28 48 29 2a 99 28 32 5e 28 2d 49 29 29 0d |-.(H)*.(2^(-I)).| 00000100 00 96 06 20 ed 0d 00 a0 23 20 54 3d 58 2d 48 2a |... ....# T=X-H*| 00000110 59 3a f4 20 6c 69 6e 65 61 72 20 69 6e 74 65 72 |Y:. linear inter| 00000120 70 6f 6c 61 74 69 6f 6e 0d 00 aa 0c 20 59 3d 59 |polation.... Y=Y| 00000130 2b 48 2a 58 0d 00 b4 08 20 58 3d 54 0d 00 be 16 |+H*X.... X=T....| 00000140 20 f1 20 27 22 55 73 69 6e 67 20 43 4f 52 44 49 | . '"Using CORDI| 00000150 43 22 0d 00 c8 13 20 f1 20 22 63 6f 73 28 68 29 |C".... . "cos(h)| 00000160 3d 20 22 3b 58 0d 00 d2 13 20 f1 20 22 73 69 6e |= ";X.... . "sin| 00000170 28 68 29 3d 20 22 3b 59 0d 00 dc 15 20 f1 20 27 |(h)= ";Y.... . '| 00000180 22 55 73 69 6e 67 20 42 41 53 49 43 22 0d 00 e6 |"Using BASIC"...| 00000190 14 20 f1 20 22 63 6f 73 28 68 29 3d 20 22 3b 9b |. . "cos(h)= ";.| 000001a0 4f 0d 00 f0 14 20 f1 20 22 73 69 6e 28 68 29 3d |O.... . "sin(h)=| 000001b0 20 22 3b b5 4f 0d 00 fa 07 fd 20 a3 0d ff | ";.O..... ...| 000001be