头文件:#include <math.h>
定义函数:double asin (double x)
函数说明:asin()用来计算参数x 的反正弦值,然后将结果返回。参数x 范围为-1 至1 之间,超过此范围则会失败。
返回值:返回-PI/2 之PI/2 之间的计算结果。
错误代码:EDOM 参数x 超出范围。
注意,使用 GCC 编译时请加入-lm。
范例
#include <stdio.h>
#include <math.h>
int main()
{
double angle;
angle = asin (0.5);
printf("angle = %f\n", angle);
return 0;
}Makefile文件:
CXX=g++
CFLAGS=-O3 -Wall -fmessage-length=0 -fPIC -DARCH_x86
OBJS=asin.o
LIBS+=
TARGET= Tasin
$(TARGET):$(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(CFLAGS) $(LIBS)
chmod 6755 $(TARGET)
all:$(TARGET)
install: all
chmod 6755 $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)运行结果:
[root@localhost asin]# make
make: Warning: File `Makefile' has modification time 13 s in the future
cc -O3 -Wall -fmessage-length=0 -fPIC -DARCH_x86 -c -o asin.o asin.c
g++ -o Tasin asin.o -O3 -Wall -fmessage-length=0 -fPIC -DARCH_x86
chmod 6755 Tasin
make: warning: Clock skew detected. Your build may be incomplete.
[root@localhost asin]# ./Tasin
angle = 0.523599

22

被折叠的 条评论
为什么被折叠?



