数学函数
来源:互联网 发布:uc矩阵表主要作用 编辑:程序博客网 时间:2024/05/30 13:42
头文件math.h中含有大量的数学函数声明。
数学函数
-----------------------------------------------------------------------------------------------------
函数 运算
-----------------------------------------------------------------------------------------------------
floor(x) 返回不大于x的double类型最大整数值
ceil(x) 返回不小于x的double类型最小整数值
fabs(x) 返回x的绝对值
log(x) 返回x的(以e为底)自然对数
log10(x) 返回x以10为底的对数
exp(x) 返回e的x次的值
sqrt(x) 返回x的平方根
pow(x,y) 返回x的y次
-------------------------------------------------------------------------------------------------------
测试的程序如下:
#include<stdio.h>
#include <math.h>
int main()
{
double x=2.5f;
double y=-2.5f;
printf("\n the floor is %lf and %lf",floor(x),floor(y));
printf("\n the ceil is %lf and %lf",ceil(x),ceil(y));
printf("\n the fabs is %lf and %lf",fabs(x),fabs(y));
printf("\n the log is %lf and %lf",log(x),log(100000));
printf("\n the log10 is %lf and %lf",log10(x),log10(100000));
printf("\n the exp is %lf and %lf",exp(x),exp(y));
printf("\n the sqrt is %lf and %lf",sqrt(x),sqrt(100));
return 0;
}
运行的结果如下:
the floor is 2.000000 and -3.000000
the ceil is 3.000000 and -2.000000
the fabs is 2.500000 and 2.500000
the log is 0.916291 and 11.512925
the log10 is 0.397940 and 5.000000
the exp is 12.182494 and 0.082085
the sqrt is 1.581139 and 10.000000
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学 函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- 数学函数
- iOS_数学函数数学函数
- android开发命令行给apk签名
- 新浪sae部署django1.4
- Linux内核多线程(一)
- C++对文件的操作(不断更新中)
- cookie、session及实现记住密码,自动登录
- 数学函数
- 磁盘分区以及分区的类型、格式化的作用
- SCI常见经典句型
- CUDA shared memory使用
- 谷歌黑客语法
- Linux内核多线程(二)
- 最近WEB安全扫描问题汇总
- jquery获得select option的值 和对select option的操作
- 制作C++程序安装包