Home » Archimedes archive » Archimedes World » AW-1996-06-Disc 1.adf » !AcornAns_AcornAns » MathFns/ReadMe

MathFns/ReadMe

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 » Archimedes World » AW-1996-06-Disc 1.adf » !AcornAns_AcornAns
Filename: MathFns/ReadMe
Read OK:
File size: 033C bytes
Load address: 0000
Exec address: 0000
File contents
See AcornAnswers in magazine for details.

Briefly, the 'Demo' program demonstrates how to code assembler routines
to evaluate mathematical functions such as ln, exp, sin, cos etc, using
polynomial approximation and additional techniques.

It graphs various functions for which it contains routines & also plots
the errors these approximations produce compared to the much slower
floating point routines contained in FPEmulator.

Sample code (for ln, exp, sin & cos, asn & acs) can be found in
MathFns.s.subrouts1. It is heavily commented.

The 'Coef' program assists in the calculation of suitable polynomials
for arbitrary functions, to allow you to code your own new functions.

Before undertaking such a task I suggest you try to construct your own
cos routine with it & compare your results to that in the subrouts1 file.
00000000  0a 53 65 65 20 41 63 6f  72 6e 41 6e 73 77 65 72  |.See AcornAnswer|
00000010  73 20 69 6e 20 6d 61 67  61 7a 69 6e 65 20 66 6f  |s in magazine fo|
00000020  72 20 64 65 74 61 69 6c  73 2e 0a 0a 42 72 69 65  |r details...Brie|
00000030  66 6c 79 2c 20 74 68 65  20 27 44 65 6d 6f 27 20  |fly, the 'Demo' |
00000040  70 72 6f 67 72 61 6d 20  64 65 6d 6f 6e 73 74 72  |program demonstr|
00000050  61 74 65 73 20 68 6f 77  20 74 6f 20 63 6f 64 65  |ates how to code|
00000060  20 61 73 73 65 6d 62 6c  65 72 20 72 6f 75 74 69  | assembler routi|
00000070  6e 65 73 0a 74 6f 20 65  76 61 6c 75 61 74 65 20  |nes.to evaluate |
00000080  6d 61 74 68 65 6d 61 74  69 63 61 6c 20 66 75 6e  |mathematical fun|
00000090  63 74 69 6f 6e 73 20 73  75 63 68 20 61 73 20 6c  |ctions such as l|
000000a0  6e 2c 20 65 78 70 2c 20  73 69 6e 2c 20 63 6f 73  |n, exp, sin, cos|
000000b0  20 65 74 63 2c 20 75 73  69 6e 67 0a 70 6f 6c 79  | etc, using.poly|
000000c0  6e 6f 6d 69 61 6c 20 61  70 70 72 6f 78 69 6d 61  |nomial approxima|
000000d0  74 69 6f 6e 20 61 6e 64  20 61 64 64 69 74 69 6f  |tion and additio|
000000e0  6e 61 6c 20 74 65 63 68  6e 69 71 75 65 73 2e 0a  |nal techniques..|
000000f0  0a 49 74 20 67 72 61 70  68 73 20 76 61 72 69 6f  |.It graphs vario|
00000100  75 73 20 66 75 6e 63 74  69 6f 6e 73 20 66 6f 72  |us functions for|
00000110  20 77 68 69 63 68 20 69  74 20 63 6f 6e 74 61 69  | which it contai|
00000120  6e 73 20 72 6f 75 74 69  6e 65 73 20 26 20 61 6c  |ns routines & al|
00000130  73 6f 20 70 6c 6f 74 73  0a 74 68 65 20 65 72 72  |so plots.the err|
00000140  6f 72 73 20 74 68 65 73  65 20 61 70 70 72 6f 78  |ors these approx|
00000150  69 6d 61 74 69 6f 6e 73  20 70 72 6f 64 75 63 65  |imations produce|
00000160  20 63 6f 6d 70 61 72 65  64 20 74 6f 20 74 68 65  | compared to the|
00000170  20 6d 75 63 68 20 73 6c  6f 77 65 72 0a 66 6c 6f  | much slower.flo|
00000180  61 74 69 6e 67 20 70 6f  69 6e 74 20 72 6f 75 74  |ating point rout|
00000190  69 6e 65 73 20 63 6f 6e  74 61 69 6e 65 64 20 69  |ines contained i|
000001a0  6e 20 46 50 45 6d 75 6c  61 74 6f 72 2e 0a 0a 53  |n FPEmulator...S|
000001b0  61 6d 70 6c 65 20 63 6f  64 65 20 28 66 6f 72 20  |ample code (for |
000001c0  6c 6e 2c 20 65 78 70 2c  20 73 69 6e 20 26 20 63  |ln, exp, sin & c|
000001d0  6f 73 2c 20 61 73 6e 20  26 20 61 63 73 29 20 63  |os, asn & acs) c|
000001e0  61 6e 20 62 65 20 66 6f  75 6e 64 20 69 6e 0a 4d  |an be found in.M|
000001f0  61 74 68 46 6e 73 2e 73  2e 73 75 62 72 6f 75 74  |athFns.s.subrout|
00000200  73 31 2e 20 49 74 20 69  73 20 68 65 61 76 69 6c  |s1. It is heavil|
00000210  79 20 63 6f 6d 6d 65 6e  74 65 64 2e 0a 0a 54 68  |y commented...Th|
00000220  65 20 27 43 6f 65 66 27  20 70 72 6f 67 72 61 6d  |e 'Coef' program|
00000230  20 61 73 73 69 73 74 73  20 69 6e 20 74 68 65 20  | assists in the |
00000240  63 61 6c 63 75 6c 61 74  69 6f 6e 20 6f 66 20 73  |calculation of s|
00000250  75 69 74 61 62 6c 65 20  70 6f 6c 79 6e 6f 6d 69  |uitable polynomi|
00000260  61 6c 73 0a 66 6f 72 20  61 72 62 69 74 72 61 72  |als.for arbitrar|
00000270  79 20 66 75 6e 63 74 69  6f 6e 73 2c 20 74 6f 20  |y functions, to |
00000280  61 6c 6c 6f 77 20 79 6f  75 20 74 6f 20 63 6f 64  |allow you to cod|
00000290  65 20 79 6f 75 72 20 6f  77 6e 20 6e 65 77 20 66  |e your own new f|
000002a0  75 6e 63 74 69 6f 6e 73  2e 0a 0a 42 65 66 6f 72  |unctions...Befor|
000002b0  65 20 75 6e 64 65 72 74  61 6b 69 6e 67 20 73 75  |e undertaking su|
000002c0  63 68 20 61 20 74 61 73  6b 20 49 20 73 75 67 67  |ch a task I sugg|
000002d0  65 73 74 20 79 6f 75 20  74 72 79 20 74 6f 20 63  |est you try to c|
000002e0  6f 6e 73 74 72 75 63 74  20 79 6f 75 72 20 6f 77  |onstruct your ow|
000002f0  6e 0a 63 6f 73 20 72 6f  75 74 69 6e 65 20 77 69  |n.cos routine wi|
00000300  74 68 20 69 74 20 26 20  63 6f 6d 70 61 72 65 20  |th it & compare |
00000310  79 6f 75 72 20 72 65 73  75 6c 74 73 20 74 6f 20  |your results to |
00000320  74 68 61 74 20 69 6e 20  74 68 65 20 73 75 62 72  |that in the subr|
00000330  6f 75 74 73 31 20 66 69  6c 65 2e 0a              |outs1 file..|
0000033c