home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_100
/
188_01
/
trns1.doc
< prev
Wrap
Text File
|
1987-09-30
|
4KB
|
69 lines
Transcendenta∞ Function≤ Versioε 1.1
Thσá codσ originall∙ issueΣ iε ├ Usersº Grou≡ Volumσá 18╕ ì
ha≤á beeε adapteΣ t∩ ruε oε Ecosof⌠ ├ a≤ wel∞ a≤ MI╪á C«á Thσ ì
MI╪á ├ versioε wil∞ ruε oε Azteπ ├ iµ thσ frexp(⌐ anΣá ldexp(⌐ ì
function≤ supplieΣ iε Azteπ m.liΓ arσ used¼ bu⌠ Azteπ arithmeì
tiπ i≤ no⌠ accuratσ enougΦ t∩ justif∙ thσ numbe≥ oµ term≤ useΣ ì
iε thσ polynomials.
┴á tan(⌐á functioεá ha≤ beeε addeΣ whicΦá use≤á ßá singlσ ì
rationa∞ polynomia∞ approximatioε t∩ cove≥ thσ wholσ rangσá oµ ì
+- PI/2¼á witΦá minima°á relativσ error«á Thi≤ ha≤ proveεá a≤ ì
accuratσá anΣá nearl∙ a≤ fas⌠ a≤ an∙ oµ thσá morσá complicateΣ ì
method≤ whicΦ thσ autho≥ ha≤ seen.
Coefficient≤á oµ polynomial≤ havσ beeε recalculateΣ usinτ ì
Chebyshe÷á fit≤á t∩ function≤ sucΦá a≤á sin(x)/x¼á whicΦá givσ ì
bette≥á averagσá relativσ erro≥ thaε ß minimuφ relativσá erro≥ ì
fit«á Thσ approximatioε fo≥ log2(⌐ ha≤ les≤ erro≥á everywherσ ì
thaε thσ bes⌠ relativσ erro≥ fits«á Chebyshe÷ polynomial≤ arσ ì
morσá economica∞á anΣ reproduciblσ t∩ calculatσá thaεá minimuφ ì
relativσ erro≥ polynomials¼ bu⌠ arσ no⌠ applicablσ t∩ rationa∞ ì
approximations.
EcoSof⌠á ├ doe≤ no⌠ providσ ßá floor(⌐á function«á Sincσ ì
thi≤á presumabl∙ mean≤ tha⌠ thσ developer≤ founΣ thei≥á dint(⌐ ì
functioε t∩ bσ morσ efficient¼ thσ conditiona∞ compilatioε fo≥ ì
EcoSof⌠ versioε set≤ u≡ thi≤ substitution¼ a≤ wel∞ a≤ carryinτ ì
ou⌠á EcoSoft'≤ suggestioε tha⌠ commoε constant≤ bσ referreΣ t∩ ì
b∙á thσ librar∙ name≤ t∩ savσ thσ ╕ byte≤ whicΦ woulΣ bσá useΣ ì
iε eacΦ functioε whicΦ carrie≤ it≤ owε copy¼ anΣ usσ value≤ t∩ ì
ful∞ machinσ accuracy.
Neithe≥á EcoSof⌠ no≥ MI╪ wil∞ compilσ negativσ doublσá o≥ ì
floa⌠á constants╗á howeve≥á MI╪ simpl∙ compile≤á thσá absolutσ ì
valuσá anΣ s∩ accept≤ standarΣ codσ withou⌠ warninτá oµá erroì
neou≤ results«á BotΦ compiler≤ carr∙ 5╢ bit≤ precisioε arithì
metic¼á althougΦá thσ MI╪ compile≥ doe≤ no⌠ appea≥ t∩ reaΣ thσ ì
equivalen⌠á 1╖ o≥ morσ digit≤ oµ constants«á Sincσ thσá sin(⌐ ì
functioε oµ thσ MI╪ versioε i≤ accuratσ onl∙ t∩ 1╢ digits¼ thσ ì
EcoSof⌠ versioε extend≤ precisioε t∩ 1╣ digits.
Thσ followinτ tablσ show≤ thσ numbe≥ oµ term≤ requireΣ t∩ ì
achievσá specifieΣ accurac∙ usinτ thesσ approximation≤ t∩á thσ ì
standarΣá transcendenta∞á functions«á Thosσ wh∩ arσá familia≥ ì
witΦá somσá oµ thσ commercia∞ librarie≤ ma∙ notσ morσá thaεá ß ì
coincidenta∞á attractioε t∩ approximation≤ whicΦ arσá accuratσ ì
t∩ 6¼á 10¼á o≥ 1│ digits¼á wherσ benchmarδ competition≤ ma∙ bσ ì
woε b∙ fallinτ shor⌠ oµ ful∞ machinσ accuracy« Approximation≤ ì
t∩á 1╕á o≥á 21.╡á digit≤ sharσ thσá samσá propert∙á oµá havinτ ì
efficien⌠á approximation≤ availablσ fo≥ mos⌠ oµ thσá importan⌠ ì
functions.
.paè Terms Required for Transcendental Approximations
.------!---!---!---!---!---!---!---!---!---!---!---!---!---!-R
_____________________________________________________________
log() 3 4 5 6 7 8 9 10 11 12 13 14
exp() 3 4 5 6 7
sinh 3 4 5 6 7 8 9 10 11
sin() 4 5 6 7 8 9 10 11 12 13
tan() 5 6 7 8 9 10
atan() 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
____________________________________________________________
Digits 6 8 10 12 14 16 18 20 22 24 26 28 30 32