Skip to navigation

Lander on the Acorn Archimedes

Maths (Geometry): arctanTable

Name: arctanTable [Show more] Type: Variable Category: Maths (Geometry) Summary: Arctan lookup table Deep dive: Flying by mouse
Context: See this variable in context in the source code References: This variable is used as follows: * arctanTableAddr uses arctanTable

At byte n, the table contains: ((2^31 - 1) / PI) * arctan(n / 128) For n = 0 to 127 In the original BBC BASIC source, this table would have been populated using something along these lines: FOR I% = 0 TO 127 [ OPT pass% EQUD ((2^31 - 1) / PI) * ATN(I% / 128) ] NEXT I have used EQUDs here because different computers have different algorithms and accuracies in their maths routines, so the only way to ensure a complete match with the original binaries is to hard-code the values. The above loop produces the correct values when run on an Archimedes.
.arctanTable EQUD &00000000, &00517C55, &00A2F61E, &00F46AD0 EQUD &0145D7E1, &01973AC7, &01E890FC, &0239D7FB EQUD &028B0D43, &02DC2E53, &032D38B3, &037E29EB EQUD &03CEFF89, &041FB721, &04704E4A, &04C0C2A4 EQUD &051111D4, &05613983, &05B13767, &06010937 EQUD &0650ACB6, &06A01FAE, &06EF5FF1, &073E6B5A EQUD &078D3FCE, &07DBDB3A, &082A3B94, &08785EDF EQUD &08C64325, &0913E67C, &09614703, &09AE62E6 EQUD &09FB385B, &0A47C5A2, &0A940907, &0AE000E1 EQUD &0B2BAB95, &0B77078F, &0BC2134B, &0C0CCD4E EQUD &0C57342A, &0CA1467C, &0CEB02EF, &0D346836 EQUD &0D7D7514, &0DC62856, &0E0E80D4, &0E567D73 EQUD &0E9E1D23, &0EE55EE2, &0F2C41B6, &0F72C4B3 EQUD &0FB8E6F9, &0FFEA7B0, &1044060F, &10890156 EQUD &10CD98D1, &1111CBD6, &115599C6, &1199020E EQUD &11DC0423, &121E9F86, &1260D3C1, &12A2A069 EQUD &12E4051D, &13250183, &1365954E, &13A5C038 EQUD &13E58203, &1424DA7D, &1463C97A, &14A24ED7 EQUD &14E06A7A, &151E1C50, &155B6450, &15984275 EQUD &15D4B6C4, &1610C149, &164C6216, &16879945 EQUD &16C266F6, &16FCCB50, &1736C67E, &177058B5 EQUD &17A9822C, &17E24322, &181A9BDA, &18528C9E EQUD &188A15BB, &18C13785, &18F7F252, &192E467F EQUD &1964346D, &1999BC80, &19CEDF21, &1A039CBD EQUD &1A37F5C4, &1A6BEAA9, &1A9F7BE4, &1AD2A9EF EQUD &1B057548, &1B37DE6E, &1B69E5E5, &1B9B8C33 EQUD &1BCCD1DF, &1BFDB775, &1C2E3D81, &1C5E6491 EQUD &1C8E2D38, &1CBD9807, &1CECA593, &1D1B5671 EQUD &1D49AB3A, &1D77A486, &1DA542F0, &1DD28713 EQUD &1DFF718C, &1E2C02F7, &1E583BF4, &1E841D21 EQUD &1EAFA71E, &1EDADA8D, &1F05B80D, &1F304042 EQUD &1F5A73CC, &1F84534E, &1FADDF6B, &1FD718C5