Hi,请教一下有木有对TI MathLib库中三角函数与根号运算具体是如何实现的说明啊
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,请教一下有木有对TI MathLib库中三角函数与根号运算具体是如何实现的说明啊
你好,我下载看了下,基本都是接口和作用介绍,但我想看的是具体比如cos函数是怎样实现的,它的源代码是啥能看吗?找到了mathlib.a674这个库文件,但是打不开~
你好;
components/ti/mathlib/src/cosdp/c674 下面应当是你要得源码。
static inline double cosdp_i (double a) { double C1 = 3.1416015625; double C2 = -8.908910206761537356617e-6; double r8 = 2.7204790957888846175e-15; double r7 = -7.6429178068910467734e-13; double r6 = 1.6058936490371589114e-10; double r5 = -2.5052106798274584544e-8; double r4 = 2.7557319210152756119e-6; double r3 = -1.9841269841201840457e-4; double r2 = 8.3333333333331650314e-3; double r1 = -1.6666666666666665052e-1; double MAX = 1.073741824e+09; double HalfPI = 1.57079632679489661923; double InvPI = 0.31830988618379067154; double Sign = 1.0; double X, Z, F, F2, G, R; int N; F = _fabs(a) + HalfPI; if (F > MAX) { F = HalfPI; } X = F * InvPI; /* X = Y * (1/PI) */ N = _dpint(X); Z = (N); /* Z = double (N) */ if ((N&1) != 0) { Sign = -Sign; /* neg. quadrants */ } F = (F - (Z*C1)) - (Z*C2); R = _fabs(F); F2 = F*F; G = F2*F2; R = (((G*r8 + r6)*G + r4)*G + r2)*G; X = (((G*r7 + r5)*G + r3)*G + r1)*F2; R = R + X; G = (F + F*R)*Sign; return (G); }