谁能提供给我SIN,COS等三角函数的原代码?

football 2003-05-16 01:37:33
谁能提供给我SIN,COS等三角函数的原代码?非常感谢。
...全文
130 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
shine333 2003-05-16
  • 打赏
  • 举报
回复
第n项 :f(n)(x0)*x^n/n!
f(n)(x0),在x0处n阶导数
shine333 2003-05-16
  • 打赏
  • 举报
回复
to programmer200x(卧龙200x)
精度就是看Rx,他是被舍弃的项,精度精确到多少完全取决于Rx是第几项
celeil 2003-05-16
  • 打赏
  • 举报
回复
晕~,学编程竟然不知道泰勒展开式,或者不知道在哪里可以找到泰勒展开式。
mechgoukiteng 2003-05-16
  • 打赏
  • 举报
回复
写个数组放入数值

到时候查表。。。。。嘿嘿
programmer200x 2003-05-16
  • 打赏
  • 举报
回复
to Solstice(大佛)
精度是多少啊?
gwsr 2003-05-16
  • 打赏
  • 举报
回复
泰勒公式:
f(x)=f(x0)+f'(x0)(x-x0)+f''(x0)(x-x0)^2/2!+....+R(x)

另:sin x=x-x^3/3!+x^5/5!-....
陈硕 2003-05-16
  • 打赏
  • 举报
回复
一段古老的代码:
/*
* Sine<N,I> Calculates sin(2*Pi*I/N)
* Cos<N,I> Calculates cos(2*Pi*I/N)
*/

/*
* First, compile-time trig functions sin(x) and cos(x).
*/

template<unsigned N, unsigned I>
class Sine {
public:
static inline float sin()
{
// This is a series expansion for sin(I*2*M_PI/N)
// Since all of these quantities are known at compile time, it gets
// simplified to a single constant, which can be included in the code:
// mov dword ptr es:[bx],large 03F3504F3h

return (I*2*M_PI/N)*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/2/3*(1-(I*2*M_PI/N)*
(I*2*M_PI/N)/4/5*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/6/7*(1-(I*2*M_PI/N)*
(I*2*M_PI/N)/8/9*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/10/11*(1-(I*2*M_PI/N)*
(I*2*M_PI/N)/12/13*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/14/15*
(1-(I*2*M_PI/N)*(I*2*M_PI/N)/16/17*
(1-(I*2*M_PI/N)*(I*2*M_PI/N)/18/19*(1-(I*2*M_PI/N)*
(I*2*M_PI/N)/20/21))))))))));
}
};


template<unsigned N, unsigned I>
class Cosine {
public:
static inline float cos()
{
// This is a series expansion for cos(I*2*M_PI/N)
// Since all of these quantities are known at compile time, it gets
// simplified to a single number.
return 1-(I*2*M_PI/N)*(I*2*M_PI/N)/2*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/3/4*
(1-(I*2*M_PI/N)*(I*2*M_PI/N)/5/6*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/7/8*
(1-(I*2*M_PI/N)*(I*2*M_PI/N)/9/10*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/11/12*
(1-(I*2*M_PI/N)*(I*2*M_PI/N)/13/14*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/15/16*
(1-(I*2*M_PI/N)*(I*2*M_PI/N)/17/18*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/19/20*
(1-(I*2*M_PI/N)*(I*2*M_PI/N)/21/22*(1-(I*2*M_PI/N)*(I*2*M_PI/N)/23/24
)))))))))));
}

};
football 2003-05-16
  • 打赏
  • 举报
回复
去下载一个J2SE的源代码,看java.lang.Math类,里面实现了三角函数的----------------
在JAVA.LANG.MATH中没有函数的具体实现,请告知实现函数的具体位置,THANKS。

手工的话用泰勒展开公式
-----是否可以给出泰勒展开公式
Cybergate 2003-05-16
  • 打赏
  • 举报
回复
fpu可以直接运算三角函数。

手工的话用泰勒展开公式
Schlemiel 2003-05-16
  • 打赏
  • 举报
回复
去下载一个J2SE的源代码,看java.lang.Math类,里面实现了三角函数的。

70,037

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧