#ifndef lint
static char sccsid[] = "@(#)asin.c 1.1 92/07/30 SMI";
#endif
/*
* Copyright (c) 1987 by Sun Microsystems, Inc.
*/
/* asin(x)
* Code originated from 4.3bsd.
* Modified by K.C. Ng for SUN 4.0 libm.
* Method :
*
* asin(x) = atan2(x,sqrt(1-x*x)); for better accuracy, 1-x*x is
* computed as follows
* 1-x*x if x < 0.5,
* 2*(1-|x|)-(1-|x|)*(1-|x|) if x >= 0.5.
*
* Special cases:
* if x is NaN, return x itself;
* if |x|>1, return NaN with invalid signal.
*
*/
#include <math.h>
#include "libm.h"
double asin(x)
double x;
{
double t,w;
w = fabs(x);
if (x!=x)
return x+x;
else if(w <= 0.5) {
if(w<1.0e-9) {dummy(1.0e9+w); return x;} else
return atan(x/sqrt(1.-x*x));
}
else if(w < 1.0) {
t = 1.0-w;
w = t+t;
return atan(x/sqrt(w-t*t));
}
else if(w == 1.0)
return atan2(x,0.0); /* asin(+-1) = +- PI/2 */
else { /* |x| > 1 create invalid signal */
return SVID_libm_err(x,x,2);
}
}
static dummy(x)
double x;
{
return 1;
}
asin.rar_Modified
版权申诉
164 浏览量
2022-09-19
22:16:49
上传
评论
收藏 2KB RAR 举报
小贝德罗
- 粉丝: 70
- 资源: 1万+
最新资源
- 以简单、易用、高性能为目标、开源的时序数据库,支持Linux及Windows, Time Series Database.zip
- python-leetcode面试题解之第198题打家劫舍-题解.zip
- python-leetcode面试题解之第191题位1的个数-题解.zip
- python-leetcode面试题解之第186题反转字符串中的单词II-题解.zip
- 一个基于python的web后端高性能开发框架,下载可用
- python-leetcode面试题解之第179题最大数-题解.zip
- python-leetcode面试题解之第170题两数之和III数据结构设计-题解.zip
- python-leetcode面试题解之第168题Excel表列名称-题解.zip
- python-leetcode面试题解之第167题两数之和II输入有序数组-题解.zip
- python-leetcode面试题解之第166题分数到小数-题解.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈