当前位置: 首页 > news >正文

C++ Reference: Standard C++ Library reference: C Library: cmath

C++官网参考链接:https://cplusplus.com/reference/cmath/

头文件 
<cmath> (math.h)

C数字库 
头文件<cmath>声明了一组函数来计算常见的数学操作和转换:

函数
三角函数

cos

Compute cosine (function) (计算余弦(函数))

sin

Compute sine (function) (计算正弦(函数))

tan

Compute tangent (function) (计算正切(函数))

acos

Compute arc cosine (function) (计算反余弦(函数))

asin

Compute arc sine (function) (计算反正弦(函数))

atan

Compute arc tangent (function) (计算反正切(函数))

atan2

Compute arc tangent with two parameters (function) (使用两个参数计算反正切(函数))

双曲函数

cosh

Compute hyperbolic cosine (function) (计算双曲余弦(函数))

sinh

Compute hyperbolic sine (function) (计算双曲正弦(函数))

tanh

Compute hyperbolic tangent (function) (计算双曲正切(函数))

acosh

Compute area hyperbolic cosine (function) (计算反双曲余弦(函数))

asinh

Compute area hyperbolic sine (function) (计算反双曲正弦(函数))

atanh

Compute area hyperbolic tangent (function) (计算反双曲正切(函数))

指数函数和对数函数

exp

Compute exponential function (function) (计算指数函数(函数))

frexp

Get significand and exponent (function) (获取有效值和指数(函数))

ldexp

Generate value from significand and exponent (function) (从有效值和指数(函数)生成值)

log

Compute natural logarithm (function) (计算自然对数(函数))

log10

Compute common logarithm (function) (计算公对数(函数))

modf

Break into fractional and integral parts (function) (分解为小数部分和整数部分(函数))

exp2

Compute binary exponential function (function) (计算二元指数函数(函数))

expm1

Compute exponential minus one (function) (计算指数减1(函数))

ilogb

Integer binary logarithm (function) (整数二进制对数(函数))

log1p

Compute logarithm plus one (function) (计算对数加1(函数))

log2

Compute binary logarithm (function) (计算二元对数(函数))

logb

Compute floating-point base logarithm (function) (计算浮点基对数(函数))

scalbn

Scale significand using floating-point base exponent (function) (使用浮点基指数(函数)进行缩放有效值)

scalbln

Scale significand using floating-point base exponent (long) (function) (使用浮点基指数(long)(函数)进行缩放有效值)

幂函数

pow

Raise to power (function) (求幂(函数))

sqrt

Compute square root (function) (计算平方根(函数))

cbrt

Compute cubic root (function) (计算立方根(函数))

hypot

Compute hypotenuse (function) (计算斜边(函数))

误差和伽马函数 

erf

Compute error function (function) (计算误差函数(函数))

erfc

Compute complementary error function (function) (计算互补误差函数(函数))

tgamma

Compute gamma function (function) (计算伽马函数(函数))

lgamma

Compute log-gamma function (function) (计算对数伽玛函数(函数))

舍入和余数函数

ceil

Round up value (function) (向上取值(函数))

floor

Round down value (function) (向下取值(函数))

fmod

Compute remainder of division (function) (计算除法的余数(函数))

trunc

Truncate value (function) (截断值(函数))

round

Round to nearest (function) (向最近舍入(函数))

lround

Round to nearest and cast to long integer (function) (向最近舍入和转换为long整型(函数))

llround

Round to nearest and cast to long long integer (function) (向最近舍入和转换为long long整型(函数))

rint

Round to integral value (function) (向整数值舍入(函数))

lrint

Round and cast to long integer (function) (舍入和转换为long整型(函数))

llrint

Round and cast to long long integer (function) (舍入和转换为long long整型(函数))

nearbyint

Round to nearby integral value (function) (舍入到附近的整数值(函数))

remainder

Compute remainder (IEC 60559) (function) (计算余数(IEC 60559)(函数))

remquo

Compute remainder and quotient (function) (计算余数和商(函数))

浮点操作函数

copysign

Copy sign (function) (复制符号(函数))

nan

Generate quiet NaN (function) (生成安静NaN(函数))

nextafter

Next representable value (function) (下一个可表示的值(函数))

nexttoward

Next representable value toward precise value (function) (下一个可表示指向精确值的值(函数))

最小值,最大值,差分函数

fdim

Positive difference (function) (正差分(函数))

fmax

Maximum value (function) (最大值(函数))

fmin

Minimum value (function) (最小值(函数))

其他函数

fabs

Compute absolute value (function) (计算绝对值(函数))

abs

Compute absolute value (function) (计算绝对值(函数))

fma

Multiply-add (function) 

宏/函数
它们在C中以宏的形式实现,在C++中以函数的形式实现: 
分类宏/函数 

fpclassify

Classify floating-point value (macro/function) (分类浮点值(宏/函数))

isfinite

Is finite value (macro) (是无限值(宏))

isinf

Is infinity (macro/function) (是无穷(宏/函数))

isnan

Is Not-A-Number (macro/function) (不是一个数(宏/函数))

isnormal

Is normal (macro/function) (是正常的(宏/函数))

signbit

Sign bit (macro/function) (符号位(宏/函数))

比较宏/函数

isgreater

Is greater (macro) (更大(宏))

isgreaterequal

Is greater or equal (macro) (大于或者等于(宏))

isless

Is less (macro) (更小(宏))

islessequal

Is less or equal (macro) (小于或等于(宏))

islessgreater

Is less or greater (macro) (更大或更小(宏))

isunordered

Is unordered (macro) (无序(宏))

宏常量

math_errhandling

Error handling (macro) (错误处理(宏))

INFINITY

Infinity (constant) (无穷(常量))

NAN

Not-A-Number (constant) (不是一个数(常量))

HUGE_VAL

Huge value (constant) (巨大的值(常量))

HUGE_VALF

Huge float value (巨大的浮点值)

HUGE_VALL

Huge long double value (constant) (巨大的长双精度值(常量))

这个头文件还定义了以下宏常量(从C99/C++ 11开始):

macrotypedescription
MATH_ERRNO
MATH_ERREXCEPT
intBitmask value with the possible values math_errhandling can take.(math_errhandling可以接受的可能值的位掩码值。)
FP_FAST_FMA
FP_FAST_FMAF
FP_FAST_FMAL
intEach, if defined, identifies for which type fma is at least as efficient as x*y+z.(每一个,如果定义,确定哪种类型的fma至少与x*y+z一样有效。)
FP_INFINITE
FP_NAN
FP_NORMAL
FP_SUBNORMAL
FP_ZERO
intThe possible values returned by fpclassify.(fpclassify返回的可能值。)
FP_ILOGB0
FP_ILOGBNAN
intSpecial values the ilogb function may return.(ilogb函数可能返回的特殊值。)

类型 

double_t

Floating-point type (type) (浮点类型(类型))

float_t

Floating-point type (type) (浮点类型(类型))

相关文章:

  • 康耐视InSight相机与西门子PLC关于Profinet通讯说明
  • JDK19新特性使用详解
  • 聊聊如何制作自定义ArcGIS Python工具箱
  • 数字图像处理-对比度调整背景相减
  • HTTP协议3)----对于网络层的详细讲解
  • [单片机框架][device层] charger 电源管理
  • [单片机框架][drivers层][bq25601] charger 电源管理
  • Java多线程--InheritableThreadLocal--使用/实例
  • java计算机毕业设计宿迁学院学生设计作品交流网站源代码+数据库+系统+lw文档
  • ByteTrack:通过关联每个检测框进行多对象跟踪
  • 新能源汽车行业资讯-2022-9-22
  • Ajax学习笔记(一)
  • 【【计算机组成原理】中央处理器(二)—— 指令执行过程
  • YOLOv5、v7改进之二十八:ICLR 2022涨点神器——即插即用的动态卷积ODConv
  • php警车管理系统设计与实现
  • Android系统模拟器绘制实现概述
  • es6--symbol
  • IDEA 插件开发入门教程
  • java8-模拟hadoop
  • Material Design
  • MySQL常见的两种存储引擎:MyISAM与InnoDB的爱恨情仇
  • python 装饰器(一)
  • React+TypeScript入门
  • Service Worker
  • vue2.0项目引入element-ui
  • 给新手的新浪微博 SDK 集成教程【一】
  • 计算机在识别图像时“看到”了什么?
  • 深度解析利用ES6进行Promise封装总结
  • 微信开源mars源码分析1—上层samples分析
  • 微信如何实现自动跳转到用其他浏览器打开指定页面下载APP
  • ​ ​Redis(五)主从复制:主从模式介绍、配置、拓扑(一主一从结构、一主多从结构、树形主从结构)、原理(复制过程、​​​​​​​数据同步psync)、总结
  • #gStore-weekly | gStore最新版本1.0之三角形计数函数的使用
  • (Oracle)SQL优化技巧(一):分页查询
  • (二)【Jmeter】专栏实战项目靶场drupal部署
  • (附源码)spring boot基于Java的电影院售票与管理系统毕业设计 011449
  • (十八)SpringBoot之发送QQ邮件
  • (实战)静默dbca安装创建数据库 --参数说明+举例
  • .cfg\.dat\.mak(持续补充)
  • .NET Core SkiaSharp 替代 System.Drawing.Common 的一些用法
  • .Net IE10 _doPostBack 未定义
  • .Net(C#)自定义WinForm控件之小结篇
  • [20140403]查询是否产生日志
  • [AIGC] Kong:一个强大的 API 网关和服务平台
  • [Angular] 笔记 8:list/detail 页面以及@Input
  • [Angular] 笔记 9:list/detail 页面以及@Output
  • [BZOJ] 2427: [HAOI2010]软件安装
  • [bzoj4010][HNOI2015]菜肴制作_贪心_拓扑排序
  • [C++]类和对象(中)
  • [IDF]聪明的小羊
  • [IE9] IE9 Beta崩溃问题解决方案
  • [JS] 常用正则表达式集(一)
  • [LeetCode]Spiral Matrix
  • [POJ2446] Chessboard(二分图最大匹配-匈牙利算法)
  • [saiku] olap数据源管理
  • [Unity3d]安卓无法加载assetbundle的问题