|
|
1.1 ! root 1: /* ! 2: * Compute the inverse tangent function. ! 3: * (Hart 5100, 17.24) ! 4: */ ! 5: #include <math.h> ! 6: ! 7: #if EMU87 ! 8: #include "emumath.h" ! 9: #endif ! 10: ! 11: static readonly double tanntab[] ={ ! 12: 0.12097470017580907217240715e+04, ! 13: 0.30310745956115083044212807e+04, ! 14: 0.27617198246138834959053784e+04, ! 15: 0.11141290728455183546172942e+04, ! 16: 0.19257920144815596134742860e+03, ! 17: 0.11322159411676465523624500e+02, ! 18: 0.97627215917176330369830000e-01 ! 19: }; ! 20: static readonly double tanmtab[] ={ ! 21: 0.12097470017580907287514197e+04, ! 22: 0.34343235961975351716547069e+04, ! 23: 0.36645449563283749893504796e+04, ! 24: 0.18216003392918464941509225e+04, ! 25: 0.42307164648090478045242060e+03, ! 26: 0.39917884248653798150199900e+02, ! 27: 0.10000000000000000000000000e+01 ! 28: }; ! 29: ! 30: double ! 31: atan(x) ! 32: double x; ! 33: { ! 34: double r; ! 35: register int i, s; ! 36: ! 37: s = 0; ! 38: i = 0; ! 39: if (x < 0.0) { ! 40: s = 1; ! 41: x = -x; ! 42: } ! 43: if (x > 1.0) { ! 44: i = 1; ! 45: x = 1/x; ! 46: } ! 47: r = x * x; ! 48: r = x * (_pol(r, tanntab, 7)/_pol(r, tanmtab, 7)); ! 49: if (i) ! 50: r = PI/2.0 - r; ! 51: if (s) ! 52: r = -r; ! 53: return (r); ! 54: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.