C++ 第九课 标准c数学函数
|
求绝对值 |
|
|
求反余弦 |
|
|
求反正弦 |
|
|
求反正切 |
|
|
求反正切,按符号判定象限 |
|
|
求不小于某值的最小整数 (求上界) |
|
|
求余弦 |
|
|
求双曲余弦 |
|
|
求商和余数 |
|
|
求e的幂 |
|
|
求浮点数的绝对值 |
|
|
求不大于某值的最大整数 (求下界) |
|
|
求模数 |
|
|
求数的科学表示法形式 |
|
|
求长整型数的绝对值 |
|
|
以科学计数法计算 |
|
|
以长整型返回商和余数 |
|
|
自然对数 |
|
|
以10为底的自然对数 |
|
|
将一个数分解成整数和小数部分 |
|
|
求幂 |
|
|
求正弦 |
|
|
求双曲正弦 |
|
|
求平方根 |
|
|
求正切 |
|
|
求双曲正切 |
abs
语法:
#include <stdlib.h> int abs( int num ); |
功能: 函数返回参数num.的绝对值。例如:
int magic_number = 10;
cout << "Enter a guess: ";
cin >> x;
cout << "Your guess was " << abs( magic_number - x ) << " away from the magic number." << endl;
相关主题:
labs().
acos
语法:
#include <math.h> double acos( double arg ); |
功能:函数返回参数arg的反余弦值。参数arg 应当在-1和1之间。
相关主题:
asin(),
atan(), atan2(), sin(), cos(), tan(), sinh(), cosh(), and tanh().
asin
语法:
#include <math.h> double asin( double arg ); |
功能:函数返回参数arg的反正弦值。参数arg 应当在-1和1之间。
相关主题:
acos(),
atan(), atan2(), sin(), cos(), tan(), sinh(), cosh(), and tanh().
atan
语法:
#include <math.h> double atan( double arg ); |
功能:函数返回参数arg的反正切值。
相关主题:
asin(),
acos(), atan2(), sin(), cos(), tan(), sinh(), cosh(), and tanh().
atan2
语法:
#include <math.h> double atan2( double y, double x ); |
功能:函数计算y/x的反正切值,按照参数的符号计算所在的象限。
相关主题:
asin(),
acos(), atan(), sin(), cos(), tan(), sinh(), cosh(), and tanh().
ceil
语法:
#include <math.h> double ceil( double num ); |
功能: 函数返回参数不小于num 的最小整数。例如,
y = 6.04;
x = ceil( y );
x为7.0.
cos
语法:
#include <math.h> double cos( double arg ); |
功能: 函数返回参数arg的余弦值,arg以弧度表示给出。
相关主题:
asin(),
acos(), atan(), sin(), atan2(), tan(),
sinh(), cosh(), and tanh().
cosh
语法:
#include <math.h> double cosh( double arg ); |
功能: 函数返回参数arg的双曲余弦值。
相关主题:
asin(),
acos(), atan(), sin(), atan2(), tan(),
sinh(), cos(), and tanh().
div
语法:
#include <stdlib.h> div_t div( int numerator, int denominator ); |
功能: 函数返回参数numerator / denominator的商和余数。结构类型div_t定义在stdlib.h中:
int quot; // 商数
int rem; // 余数
例, 以下代码显示x/y的商和余数:
div_t temp;
temp = div( x, y );
printf( "%d divided by %d yields %d with a remainder of %d\n", x, y, temp.quot, temp.rem );
相关主题:
ldiv().
exp
语法:
#include <math.h> double exp( double arg ); |
功能: 函数返回参数returns e (2.7182818) 的arg次幂。
相关主题:
log().
fabs
语法:
#include <math.h> double fabs( double arg ); |
功能: 函数返回参数arg的绝对值。
相关主题:
abs().
floor
语法:
#include <math.h> double floor( double arg ); |
功能: 函数返回参数不大于arg的最大整数。例如,
y = 6.04;
x = floor( y );
x的值为6.0.
相关主题:
ceil().
fmod
语法:
#include <math.h> double fmod( double x, double y ); |
功能: 函数返回参数x/y的余数。
相关主题:
ceil(),
floor(), and fabs().
frexp
语法:
#include <math.h> double frexp( double num, int *exp ); |
功能: 函数将参数num 分成两部分: 0.5 和1之间的尾数(由函数返回)并返回指数exp。转换成如下的科学计数法形式:
num = mantissa * (2 ^ exp)
相关主题:
ldexp().
labs
语法:
#include <stdlib.h> long labs( long num ); |
功能: 函数返回参数num的绝对值。
相关主题:
abs().
ldexp
语法:
#include <math.h> double ldexp( double num, int exp ); |
功能: 函数返回参数num * (2 ^ exp)。如果发生溢出返回HUGE_VAL。
ldiv
语法:
#include <stdlib.h> ldiv_t ldiv( long numerator, long denominator ); |
功能: 函数返回参数numerator / denominator的商和余数。结构类型 ldiv_t 定义在stdlib.h中:
long quot; // 商数
long rem; // 余数
相关主题:
div().
log
语法:
#include <math.h> double log( double num ); |
功能: 函数返回参数num的自然对数。如果num为负,产生域错误;如果num 为零,产生范围错误。
相关主题:
log10().
log10
语法:
#include <math.h> double log10( double num ); |
功能: 函数返回参数num以10为底的对数。如果num为负,产生域错误;如果num 为零,产生范围错误。
相关主题:
log().
modf
语法:
#include <math.h> double modf( double num, double *i ); |
功能: 函数将参数num 分割为整数和小数,返回小数部分并将整数部分赋给i。
pow
语法:
#include <math.h> double pow( double base, double exp ); |
功能: 函数返回以参数base 为底的exp 次幂。如果base为零或负和exp 小于等于零或非整数时,产生域错误。如果溢出,产生范围错误。
相关主题:
exp(), log(), and sqrt().
sin
语法:
#include <math.h> double sin( double arg ); |
功能: 函数返回参数arg的正弦值,arg以弧度表示给出。
相关主题:
asin(),
acos(), atan(), cosh(), atan2(), tan(),
sinh(), cos(), and tanh().
sinh
语法:
#include <math.h> double sinh( double arg ); |
功能: 函数返回参数arg的双曲正弦值。
相关主题:
asin(),
acos(), atan(), cosh(), atan2(), tan(),
sin(), cos(), and tanh().
sqrt
语法:
#include <math.h> double sqrt( double num ); |
功能: 函数返回参数num的平方根。如果num为负,产生域错误。
tan
语法:
#include <math.h> double tan( double arg ); |
功能: 函数返回参数arg的正切值,arg以弧度表示给出。
相关主题:
asin(),
acos(), atan(), cosh(), atan2(), sinh(), sin(), cos(), and
tanh().
tanh
语法:
#include <math.h> double tanh( double arg ); |
功能: 函数返回参数arg的双曲正切值。
相关主题:
asin(),
acos(), atan(), cosh(), atan2(), tan(),
sin(), cos(), and sinh().
C++ 第九课 标准c数学函数的更多相关文章
- 标准c数学函数使用方法
cppreference.com -> 标准c数学函数 -> 详解 标准c数学函数 abs 语法: #include <stdlib.h> int abs( int ...
- C++ 第十一课 标准c内存函数
calloc() 分配一个二维储存空间 free() 释放已分配空间 malloc() 分配空间 realloc() 改变已分配空间的大小 calloc 语法: #include <st ...
- 【C语言探索之旅】 第一部分第九课:函数
内容简介 1.课程大纲 2.第一部分第九课:函数 3.第一部分第十课预告: 练习题+习作 课程大纲 我们的课程分为四大部分,每一个部分结束后都会有练习题,并会公布答案.还会带大家用C语言编写三个游戏. ...
- NeHe OpenGL教程 第九课:移动图像
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- 【C语言探索之旅】 第二部分第九课: 实战"悬挂小人"游戏 答案
内容简介 1.课程大纲 2.第二部分第九课: 实战"悬挂小人"游戏 答案 3.第二部分第十课预告: 安全的文本输入 课程大纲 我们的课程分为四大部分,每一个部分结束后都会有练习题, ...
- cocos2d-x:懒人数学函数
做游戏开发,要用到比较多的数学计算,对于程序员来说,还是用一种懒一点的方法,cocos2d-x方便开发者投机取巧...提供了很多方便的的数学函数,方便我们的数学计算.以下是在网上收集到的一些常用的数学 ...
- 【函数】Oracle函数系列(2)--数学函数及日期函数
[函数]Oracle函数系列(2)--数学函数及日期函数 1 BLOG文档结构图 2 前言部分 2.1 导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不 ...
- iOS math.h数学函数
在实际工作中有些程序不可避免的需要使用数学函数进行计算,比如地图程序的地理坐标到地图坐标的变换.Objective-C做为ANSI C的扩展,使用C标准库头文件<math.h>中定义的数学 ...
- 20141031--SQL分组,数学函数,聚合函数
/* 通过代码操作:创建一个数据库,里面有一个学生信息表, 内容包括:学号,姓名,性别,体重,年龄,语数外三门课分数,班级 插入20条数据 执行以下查询操作: 1.查姓王的同学的信息 2.分别查每门课 ...
随机推荐
- NGINX前端代理TOMCAT取真实客户端IP
nginx前端代理tomcat取真实客户端IP 使用Nginx作为反向代理时,Tomcat的日志记录的客户端IP就不在是真实的客户端IP,而是Nginx代理的IP.要解决这个问题可以在Nginx配置一 ...
- MyBatis-Generator最佳实践
引用地址:http://arccode.net/2015/02/07/MyBatis-Generator%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5/ 最近使用MyBati ...
- iOS: 计算 UIWebView 的内容高度
- (void)webViewDidFinishLoad:(UIWebView *)wb { //方法1 CGFloat documentWidth = [[wb stringByEvaluating ...
- Java 数组的 12 个最佳方法
1. 声明一个数组 String[] aArray = new String[5]; String[] bArray = {"a","b","c&q ...
- android 工具类 DateUtil
提取了一些在开发过程中可能会用到的日期相关的函数作为工具类.供大家參考: /** * 日期操作工具类. * * @author shimiso */ public class DateUtil { p ...
- Ioc模式和MEF
IOC模式 Ioc模式(又称DI:Dependency Injection 依赖注射). 分离关注( Separation of Concerns : SOC)是Ioc模式和AOP产生最原始动力,通过 ...
- Material Designer的低版本兼容实现(一)—— 简介 & 目录
很长一段时间没写东西了,其实是因为最近在研究Material Designer这个东西,熬夜熬的身体也不是很好了.所以就偷懒没写东西,这回开的这个系列文章是讲如何将Material Designer在 ...
- 关于GreenPlum的一些整理
Greenplum数据库架构 Greenplum数据库基本由PostgreSQL核心增强数据库实例组合并衔接成的数据库管理系统,即Greenplum数据在PostgreSQL基础上扩展开发,每个Gre ...
- .Net Standard Http请求实例
一 ..Net Standard http协议封装 程序集: System.Net.Http.dll 命名 空间:System.Net.Http HttpClient :http请求 发送类 Form ...
- 第一章 AOP
关于AOP,通常我们会使用AspectJ注解来做,共有6中切面 前置:@Before 后置:@After 返回值:@AfterReturing 异常:@AfterThrowing 环绕:@Around ...