Skip to navigation


Maths (Arithmetic): squareRootTable

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

At byte n, the table contains: (2^31 - 1) * SQRT(n / 1024) For n = 0 to 1023 In the original BBC BASIC source, this table would have been populated using something along these lines: FOR I% = 0 TO 1023 [ OPT pass% EQUD (2^31 - 1) * SQR(I% / 1024) ] 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.
.squareRootTable EQUD &00000000, &03FFFFFF, &05A82799, &06ED9EBA EQUD &07FFFFFF, &08F1BBCD, &09CC4709, &0A953FD4 EQUD &0B504F33, &0BFFFFFF, &0CA62C1D, &0D443949 EQUD &0DDB3D74, &0E6C15A2, &0EF77508, &0F7DEF58 EQUD &0FFFFFFF, &107E0F66, &10F876CC, &116F8334 EQUD &11E3779B, &12548EB9, &12C2FC59, &132EEE75 EQUD &13988E13, &13FFFFFF, &1465655F, &14C8DC2E EQUD &152A7FA9, &158A68A4, &15E8ADD2, &16456405 EQUD &16A09E66, &16FA6EA1, &1752E50D, &17AA10D1 EQUD &17FFFFFF, &1854BFB3, &18A85C24, &18FAE0C1 EQUD &194C583A, &199CCC99, &19EC4749, &1A3AD129 EQUD &1A887293, &1AD53369, &1B211B1C, &1B6C30B8 EQUD &1BB67AE8, &1BFFFFFF, &1C48C5FF, &1C90D29C EQUD &1CD82B44, &1D1ED520, &1D64D51D, &1DAA2FEF EQUD &1DEEEA11, &1E3307CC, &1E768D39, &1EB97E45 EQUD &1EFBDEB1, &1F3DB217, &1F7EFBEB, &1FBFBF7E EQUD &1FFFFFFF, &203FC07E, &207F03EC, &20BDCD1D EQUD &20FC1ECD, &2139FB9A, &2177660F, &21B4609B EQUD &21F0ED99, &222D0F51, &2268C7F4, &22A419A2 EQUD &22DF0668, &23199043, &2353B91E, &238D82D6 EQUD &23C6EF37, &23FFFFFF, &2438B6E1, &2471157F EQUD &24A91D72, &24E0D043, &25182F72, &254F3C74 EQUD &2585F8B2, &25BC658C, &25F28458, &26285661 EQUD &265DDCEA, &2693192F, &26C80C60, &26FCB7A7 EQUD &27311C27, &27653AFA, &27991533, &27CCABDD EQUD &27FFFFFF, &28331298, &2865E49F, &28987707 EQUD &28CACABE, &28FCE0A9, &292EB9AA, &2960569E EQUD &2991B85C, &29C2DFB5, &29F3CD77, &2A24826A EQUD &2A54FF53, &2A8544F1, &2AB55400, &2AE52D36 EQUD &2B14D149, &2B4440E6, &2B737CBA, &2BA2856D EQUD &2BD15BA4, &2BFFFFFF, &2C2E731E, &2C5CB599 EQUD &2C8AC80A, &2CB8AB04, &2CE65F19, &2D13E4D8 EQUD &2D413CCC, &2D6E677F, &2D9B6577, &2DC83737 EQUD &2DF4DD42, &2E215816, &2E4DA830, &2E79CE09 EQUD &2EA5CA1B, &2ED19CDA, &2EFD46BA, &2F28C82D EQUD &2F5421A3, &2F7F5388, &2FAA5E48, &2FD5424D EQUD &2FFFFFFF, &302A97C4, &30550A00, &307F5716 EQUD &30A97F66, &30D38350, &30FD6331, &31271F66 EQUD &3150B849, &317A2E33, &31A3817C, &31CCB27A EQUD &31F5C182, &321EAEE7, &32477AFB, &32702610 EQUD &3298B075, &32C11A78, &32E96466, &33118E8B EQUD &33399932, &336184A5, &3389512C, &33B0FF0F EQUD &33D88E93, &33FFFFFF, &34275396, &344E899C EQUD &3475A253, &349C9DFD, &34C37CD9, &34EA3F28 EQUD &3510E527, &35376F15, &355DDD2E, &35842FAF EQUD &35AA66D2, &35D082D2, &35F683E8, &361C6A4C EQUD &36423638, &3667E7E2, &368D7F80, &36B2FD48 EQUD &36D86170, &36FDAC2A, &3722DDAC, &3747F628 EQUD &376CF5D0, &3791DCD5, &37B6AB6A, &37DB61BD EQUD &37FFFFFF, &3824865F, &3848F50B, &386D4C31 EQUD &38918BFF, &38B5B4A2, &38D9C644, &38FDC113 EQUD &3921A539, &394572E2, &39692A36, &398CCB60 EQUD &39B05688, &39D3CBD7, &39F72B76, &3A1A758C EQUD &3A3DAA40, &3A60C9B9, &3A83D41C, &3AA6C991 EQUD &3AC9AA3B, &3AEC7641, &3B0F2DC6, &3B31D0EF EQUD &3B545FDE, &3B76DAB9, &3B9941A1, &3BBB94B8 EQUD &3BDDD422, &3BFFFFFF, &3C221871, &3C441D99 EQUD &3C660F98, &3C87EE8D, &3CA9BA99, &3CCB73DB EQUD &3CED1A72, &3D0EAE7E, &3D30301C, &3D519F6C EQUD &3D72FC8A, &3D944794, &3DB580A9, &3DD6A7E4 EQUD &3DF7BD62, &3E18C140, &3E39B399, &3E5A948A EQUD &3E7B642E, &3E9C22A0, &3EBCCFFB, &3EDD6C59 EQUD &3EFDF7D6, &3F1E728B, &3F3EDC92, &3F5F3605 EQUD &3F7F7EFD, &3F9FB792, &3FBFDFDF, &3FDFF7FB EQUD &3FFFFFFF, &401FF803, &403FE01F, &405FB86A EQUD &407F80FD, &409F39ED, &40BEE353, &40DE7D44 EQUD &40FE07D8, &411D8325, &413CEF40, &415C4C40 EQUD &417B9A3B, &419AD946, &41BA0976, &41D92AE0 EQUD &41F83D9A, &421741B8, &4236374E, &42551E71 EQUD &4273F735, &4292C1AF, &42B17DF1, &42D02C0F EQUD &42EECC1E, &430D5E30, &432BE257, &434A58A9 EQUD &4368C136, &43871C11, &43A5694E, &43C3A8FE EQUD &43E1DB33, &43FFFFFF, &441E1775, &443C21A5 EQUD &445A1EA2, &44780E7C, &4495F145, &44B3C70E EQUD &44D18FE8, &44EF4BE3, &450CFB11, &452A9D81 EQUD &45483344, &4565BC6A, &45833904, &45A0A921 EQUD &45BE0CD1, &45DB6423, &45F8AF28, &4615EDEF EQUD &46332087, &465046FE, &466D6165, &468A6FCB EQUD &46A7723D, &46C468CB, &46E15383, &46FE3274 EQUD &471B05AC, &4737CD39, &4754892A, &4771398C EQUD &478DDE6E, &47AA77DC, &47C705E6, &47E38898 EQUD &47FFFFFF, &481C6C2A, &4838CD26, &485522FF EQUD &48716DC3, &488DAD7E, &48A9E23E, &48C60C10 EQUD &48E22AFF, &48FE3F19, &491A486B, &493646FF EQUD &49523AE4, &496E2424, &498A02CC, &49A5D6E9 EQUD &49C1A086, &49DD5FAE, &49F9146E, &4A14BED2 EQUD &4A305EE4, &4A4BF4B1, &4A678044, &4A8301A8 EQUD &4A9E78E8, &4AB9E610, &4AD5492B, &4AF0A243 EQUD &4B0BF165, &4B273699, &4B4271ED, &4B5DA369 EQUD &4B78CB19, &4B93E907, &4BAEFD3E, &4BCA07C8 EQUD &4BE508B0, &4BFFFFFF, &4C1AEDC1, &4C35D1FE EQUD &4C50ACC2, &4C6B7E16, &4C864604, &4CA10496 EQUD &4CBBB9D5, &4CD665CC, &4CF10884, &4D0BA207 EQUD &4D26325E, &4D40B993, &4D5B37AE, &4D75ACBB EQUD &4D9018C0, &4DAA7BC9, &4DC4D5DE, &4DDF2708 EQUD &4DF96F4F, &4E13AEBF, &4E2DE55E, &4E481336 EQUD &4E62384F, &4E7C54B3, &4E96686B, &4EB0737E EQUD &4ECA75F5, &4EE46FD9, &4EFE6132, &4F184A09 EQUD &4F322A66, &4F4C0251, &4F65D1D3, &4F7F98F4 EQUD &4F9957BB, &4FB30E32, &4FCCBC5F, &4FE6624C EQUD &4FFFFFFF, &50199582, &503322DB, &504CA812 EQUD &50662530, &507F9A3B, &5099073D, &50B26C3B EQUD &50CBC93E, &50E51E4D, &50FE6B70, &5117B0AE EQUD &5130EE0F, &514A2399, &51635155, &517C7748 EQUD &5195957C, &51AEABF5, &51C7BABD, &51E0C1DA EQUD &51F9C152, &5212B92D, &522BA972, &52449228 EQUD &525D7355, &52764D01, &528F1F31, &52A7E9EE EQUD &52C0AD3D, &52D96926, &52F21DAE, &530ACADD EQUD &532370B8, &533C0F47, &5354A691, &536D369A EQUD &5385BF6A, &539E4108, &53B6BB79, &53CF2EC4 EQUD &53E79AEE, &53FFFFFF, &54185DFD, &5430B4EC EQUD &544904D5, &54614DBC, &54798FA8, &5491CA9F EQUD &54A9FEA7, &54C22BC5, &54DA5200, &54F2715D EQUD &550A89E3, &55229B96, &553AA67E, &5552AA9F EQUD &556AA800, &55829EA6, &559A8E96, &55B277D7 EQUD &55CA5A6D, &55E23660, &55FA0BB3, &5611DA6C EQUD &5629A292, &56416429, &56591F37, &5670D3C1 EQUD &568881CC, &56A0295F, &56B7CA7E, &56CF652E EQUD &56E6F975, &56FE8757, &57160EDB, &572D9005 EQUD &57450ADB, &575C7F61, &5773ED9C, &578B5592 EQUD &57A2B748, &57BA12C3, &57D16807, &57E8B719 EQUD &57FFFFFF, &581742BE, &582E7F59, &5845B5D7 EQUD &585CE63C, &5874108C, &588B34CD, &58A25303 EQUD &58B96B33, &58D07D62, &58E78994, &58FE8FCE EQUD &59159015, &592C8A6D, &59437EDA, &595A6D62 EQUD &59715609, &598838D3, &599F15C6, &59B5ECE4 EQUD &59CCBE33, &59E389B8, &59FA4F76, &5A110F72 EQUD &5A27C9B1, &5A3E7E36, &5A552D06, &5A6BD626 EQUD &5A827999, &5A991764, &5AAFAF8B, &5AC64213 EQUD &5ADCCEFF, &5AF35653, &5B09D814, &5B205447 EQUD &5B36CAEE, &5B4D3C0E, &5B63A7AC, &5B7A0DCB EQUD &5B906E6F, &5BA6C99D, &5BBD1F57, &5BD36FA4 EQUD &5BE9BA85, &5BFFFFFF, &5C164017, &5C2C7ACF EQUD &5C42B02D, &5C58E033, &5C6F0AE6, &5C853049 EQUD &5C9B5060, &5CB16B2F, &5CC780BB, &5CDD9105 EQUD &5CF39C13, &5D09A1E8, &5D1FA288, &5D359DF6 EQUD &5D4B9436, &5D61854C, &5D77713B, &5D8D5807 EQUD &5DA339B4, &5DB91645, &5DCEEDBE, &5DE4C022 EQUD &5DFA8D75, &5E1055BA, &5E2618F5, &5E3BD72A EQUD &5E51905B, &5E67448D, &5E7CF3C2, &5E929DFE EQUD &5EA84346, &5EBDE39B, &5ED37F01, &5EE9157C EQUD &5EFEA710, &5F1433BE, &5F29BB8C, &5F3F3E7B EQUD &5F54BC90, &5F6A35CE, &5F7FAA37, &5F9519D0 EQUD &5FAA849B, &5FBFEA9C, &5FD54BD5, &5FEAA84B EQUD &5FFFFFFF, &601552F6, &602AA132, &603FEAB8 EQUD &60552F89, &606A6FA9, &607FAB1A, &6094E1E1 EQUD &60AA1401, &60BF417B, &60D46A54, &60E98E8E EQUD &60FEAE2C, &6113C932, &6128DFA2, &613DF17F EQUD &6152FECC, &6168078D, &617D0BC4, &61920B74 EQUD &61A706A0, &61BBFD4B, &61D0EF78, &61E5DD2A EQUD &61FAC663, &620FAB27, &62248B78, &62396759 EQUD &624E3ECD, &626311D7, &6277E079, &628CAAB7 EQUD &62A17093, &62B6320F, &62CAEF30, &62DFA7F7 EQUD &62F45C67, &63090C83, &631DB84D, &63325FC9 EQUD &634702F9, &635BA1DF, &63703C7F, &6384D2DA EQUD &639964F5, &63ADF2D0, &63C27C6F, &63D701D5 EQUD &63EB8304, &63FFFFFF, &641478C8, &6428ED61 EQUD &643D5DCE, &6451CA11, &6466322D, &647A9623 EQUD &648EF5F7, &64A351AB, &64B7A942, &64CBFCBE EQUD &64E04C21, &64F4976E, &6508DEA8, &651D21D0 EQUD &653160EA, &65459BF8, &6559D2FC, &656E05F8 EQUD &658234F0, &65965FE5, &65AA86DA, &65BEA9D0 EQUD &65D2C8CC, &65E6E3CE, &65FAFADA, &660F0DF1 EQUD &66231D17, &6637284C, &664B2F94, &665F32F1 EQUD &66733265, &66872DF3, &669B259C, &66AF1963 EQUD &66C3094B, &66D6F555, &66EADD84, &66FEC1DA EQUD &6712A259, &67267F04, &673A57DC, &674E2CE4 EQUD &6761FE1E, &6775CB8D, &67899532, &679D5B0F EQUD &67B11D27, &67C4DB7C, &67D89611, &67EC4CE6 EQUD &67FFFFFF, &6813AF5D, &68275B03, &683B02F2 EQUD &684EA72D, &686247B6, &6875E48F, &68897DBA EQUD &689D1339, &68B0A50E, &68C4333C, &68D7BDC3 EQUD &68EB44A7, &68FEC7E9, &6912478C, &6925C391 EQUD &69393BFA, &694CB0CA, &69602202, &69738FA4 EQUD &6986F9B3, &699A6030, &69ADC31D, &69C1227C EQUD &69D47E50, &69E7D69A, &69FB2B5B, &6A0E7C97 EQUD &6A21CA4F, &6A351484, &6A485B39, &6A5B9E70 EQUD &6A6EDE2B, &6A821A6A, &6A955332, &6AA88882 EQUD &6ABBBA5D, &6ACEE8C5, &6AE213BD, &6AF53B44 EQUD &6B085F5E, &6B1B800D, &6B2E9D51, &6B41B72E EQUD &6B54CDA4, &6B67E0B6, &6B7AF066, &6B8DFCB4 EQUD &6BA105A4, &6BB40B36, &6BC70D6D, &6BDA0C4A EQUD &6BED07D0, &6BFFFFFF, &6C12F4DA, &6C25E662 EQUD &6C38D499, &6C4BBF81, &6C5EA71C, &6C718B6B EQUD &6C846C71, &6C974A2D, &6CAA24A4, &6CBCFBD5 EQUD &6CCFCFC4, &6CE2A071, &6CF56DDE, &6D08380D EQUD &6D1AFF00, &6D2DC2B8, &6D408337, &6D53407F EQUD &6D65FA91, &6D78B16F, &6D8B651A, &6D9E1594 EQUD &6DB0C2E0, &6DC36CFD, &6DD613EF, &6DE8B7B7 EQUD &6DFB5855, &6E0DF5CD, &6E20901F, &6E33274D EQUD &6E45BB59, &6E584C44, &6E6ADA10, &6E7D64BE EQUD &6E8FEC50, &6EA270C8, &6EB4F227, &6EC7706E EQUD &6ED9EBA0, &6EEC63BE, &6EFED8C8, &6F114AC2 EQUD &6F23B9AB, &6F362587, &6F488E56, &6F5AF41A EQUD &6F6D56D4, &6F7FB686, &6F921332, &6FA46CD8 EQUD &6FB6C37B, &6FC9171B, &6FDB67BB, &6FEDB55C EQUD &6FFFFFFF, &701247A5, &70248C51, &7036CE04 EQUD &70490CBE, &705B4883, &706D8152, &707FB72D EQUD &7091EA17, &70A41A0F, &70B64719, &70C87134 EQUD &70DA9863, &70ECBCA7, &70FEDE02, &7110FC74 EQUD &712317FF, &713530A5, &71474667, &71595946 EQUD &716B6944, &717D7661, &718F80A1, &71A18803 EQUD &71B38C89, &71C58E35, &71D78D08, &71E98902 EQUD &71FB8227, &720D7876, &721F6BF2, &72315C9B EQUD &72434A73, &7255357C, &72671DB6, &72790323 EQUD &728AE5C4, &729CC59A, &72AEA2A8, &72C07CED EQUD &72D2546C, &72E42926, &72F5FB1B, &7307CA4E EQUD &731996C0, &732B6071, &733D2763, &734EEB98 EQUD &7360AD10, &73726BCE, &738427D1, &7395E11C EQUD &73A797AF, &73B94B8D, &73CAFCB6, &73DCAB2B EQUD &73EE56ED, &73FFFFFF, &7411A660, &74234A13 EQUD &7434EB19, &74468972, &74582520, &7469BE25 EQUD &747B5481, &748CE835, &749E7943, &74B007AC EQUD &74C19372, &74D31C95, &74E4A316, &74F626F7 EQUD &7507A839, &751926DD, &752AA2E5, &753C1C50 EQUD &754D9322, &755F075A, &757078FA, &7581E804 EQUD &75935477, &75A4BE56, &75B625A1, &75C78A5A EQUD &75D8EC82, &75EA4C1A, &75FBA923, &760D039E EQUD &761E5B8C, &762FB0EF, &764103C8, &76525417 EQUD &7663A1DE, &7674ED1D, &768635D7, &76977C0C EQUD &76A8BFBD, &76BA00EC, &76CB3F99, &76DC7BC5 EQUD &76EDB572, &76FEECA1, &77102152, &77215388 EQUD &77328342, &7743B082, &7754DB49, &77660399 EQUD &77772971, &77884CD4, &77996DC2, &77AA8C3D EQUD &77BBA844, &77CCC1DB, &77DDD900, &77EEEDB7 EQUD &77FFFFFF, &78110FD9, &78221D48, &7833284A EQUD &784430E3, &78553712, &78663AD9, &78773C39 EQUD &78883B33, &789937C8, &78AA31F8, &78BB29C5 EQUD &78CC1F30, &78DD123A, &78EE02E4, &78FEF12E EQUD &790FDD1B, &7920C6AA, &7931ADDD, &794292B5 EQUD &79537532, &79645557, &79753323, &79860E98 EQUD &7996E7B6, &79A7BE80, &79B892F5, &79C96516 EQUD &79DA34E5, &79EB0263, &79FBCD90, &7A0C966D EQUD &7A1D5CFC, &7A2E213E, &7A3EE332, &7A4FA2DB EQUD &7A606039, &7A711B4D, &7A81D419, &7A928A9C EQUD &7AA33ED8, &7AB3F0CE, &7AC4A07F, &7AD54DEB EQUD &7AE5F914, &7AF6A1FB, &7B0748A0, &7B17ED05 EQUD &7B288F29, &7B392F0F, &7B49CCB8, &7B5A6823 EQUD &7B6B0152, &7B7B9846, &7B8C2D00, &7B9CBF80 EQUD &7BAD4FC8, &7BBDDDD8, &7BCE69B1, &7BDEF355 EQUD &7BEF7AC4, &7BFFFFFF, &7C108306, &7C2103DC EQUD &7C318280, &7C41FEF3, &7C527937, &7C62F14C EQUD &7C736732, &7C83DAEC, &7C944C7A, &7CA4BBDC EQUD &7CB52914, &7CC59423, &7CD5FD08, &7CE663C6 EQUD &7CF6C85C, &7D072ACC, &7D178B17, &7D27E93D EQUD &7D384540, &7D489F20, &7D58F6DD, &7D694C7A EQUD &7D799FF6, &7D89F153, &7D9A4090, &7DAA8DB0 EQUD &7DBAD8B3, &7DCB219A, &7DDB6865, &7DEBAD16 EQUD &7DFBEFAD, &7E0C302B, &7E1C6E91, &7E2CAADF EQUD &7E3CE517, &7E4D1D39, &7E5D5346, &7E6D873F EQUD &7E7DB925, &7E8DE8F8, &7E9E16BA, &7EAE426A EQUD &7EBE6C0A, &7ECE939B, &7EDEB91E, &7EEEDC92 EQUD &7EFEFDFA, &7F0F1D55, &7F1F3AA5, &7F2F55EA EQUD &7F3F6F25, &7F4F8657, &7F5F9B81, &7F6FAEA3 EQUD &7F7FBFBE, &7F8FCED4, &7F9FDBE4, &7FAFE6EF EQUD &7FBFEFF7, &7FCFF6FB, &7FDFFBFE, &7FEFFEFF