Namespaces
Variants

Common mathematical functions

From cppreference.net
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99) (C99) (C99) (C23)
Maximum/minimum operations
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
(C99) (C99) (C99)
(C23) (C23) (C23) (C23)
Floating-point manipulation
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent
Decimal re-encoding functions
Total order and payload functions
Classification
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Types
Macro constants
Special floating-point values
Arguments and return values
Error handling
Fast operation indicators

目录

类型

定义于头文件 <stdlib.h>
结构体类型, div 函数的返回值
(typedef)
结构体类型, ldiv 函数的返回值
(typedef)
(C99)
结构体类型, lldiv 函数的返回值
(typedef)
定义于头文件 <inttypes.h>
结构体类型, imaxdiv 函数的返回值
(typedef)
定义于头文件 <math.h>
(C99)
最高效的浮点类型,宽度至少与 float 相同
(typedef)
最高效的浮点类型,宽度至少与 double 相同
(typedef)

常量

定义于头文件 <math.h>
分别表示对于 float double long double 过大而无法表示的值(无穷大)
(宏常量)
求值为正无穷大或保证会使 float 溢出的值
(宏常量)
(C99)
求值为 float 类型的静默 NaN
(宏常量)
指示 fma 函数通常执行速度与双精度操作数的乘加操作相当或更快
(宏常量)
若 x 分别为零或 NaN,则求值为 ilogb ( x )
(宏常量)
定义通用数学函数使用的错误处理机制
(宏常量)
分类
指示浮点数类别
(宏常量)

函数

定义于头文件 <stdlib.h>
计算整数值的绝对值 ( |x| )
(函数)
计算整数除法的商和余数
(函数)
定义于头文件 <inttypes.h>
(C99)
计算整数值的绝对值 ( |x| )
(函数)
(C99)
计算整数除法的商和余数
(函数)
定义于头文件 <math.h>
基础运算
(C99) (C99)
计算浮点值的绝对值 ( |x| )
(函数)
(C99) (C99)
计算浮点除法运算的余数
(函数)
计算浮点除法运算的有符号余数
(函数)
(C99) (C99) (C99)
计算有符号余数及除法运算的最后三位
(函数)
(C99) (C99) (C99)
计算融合乘加运算
(函数)
(C99) (C99) (C99)
确定两个浮点值中的较大者
(函数)
(C99) (C99) (C99)
确定两个浮点值中的较小者
(函数)
(C99) (C99) (C99)
确定两个浮点值的正差 ( max(0, x-y) )
(函数)
(C99) (C99) (C99)
返回一个非数值 (NaN)
(函数)
指数函数
(C99) (C99)
计算 e 的给定次幂 ( e x )
(函数)
(C99) (C99) <span class="t-mark

参考文献

  • C23 标准 (ISO/IEC 9899:2024):
  • 7.8 整数类型格式转换 <inttypes.h> (页: TBD)
  • 7.12 数学运算 <math.h> (页: TBD)
  • 7.22 通用工具 <stdlib.h> (页: TBD)
  • 7.31.5 整数类型格式转换 <inttypes.h> (页: TBD)
  • 7.31.12 通用工具 <stdlib.h> (页: TBD)
  • C17 标准 (ISO/IEC 9899:2018):
  • 7.8 整数类型格式转换 <inttypes.h> (页码: 158-160)
  • 7.12 数学函数 <math.h> (页码: 169-190)
  • 7.22 通用工具 <stdlib.h> (页码: 248-262)
  • 7.31.5 整数类型格式转换 <inttypes.h> (页码: 332)
  • 7.31.12 通用工具 <stdlib.h> (页码: 333)
  • C11 标准 (ISO/IEC 9899:2011):
  • 7.8 整数类型格式转换 <inttypes.h> (页码: 217-220)
  • 7.12 数学运算 <math.h> (页码: 231-261)
  • 7.22 通用工具 <stdlib.h> (页码: 340-360)
  • 7.31.5 整数类型格式转换 <inttypes.h> (页码: 455)
  • 7.31.12 通用工具 <stdlib.h> (页码: 456)
  • C99 标准(ISO/IEC 9899:1999):
  • 7.8 整型格式转换 <inttypes.h>(页码:198-201)
  • 7.12 数学函数 <math.h>(页码:212-242)
  • 7.20 通用工具 <stdlib.h>(页码:306-324)
  • 7.26.4 整型格式转换 <inttypes.h>(页码:401)
  • 7.26.10 通用工具 <stdlib.h>(页码:402)
  • C89/C90 标准 (ISO/IEC 9899:1990):
  • 4.5 数学函数 <math.h>
  • 4.10 通用工具 <stdlib.h>
  • 4.13.4 数学函数 <math.h>
  • 7.13.7 通用工具 <stdlib.h>

参见

C++ 文档 关于 常用数学函数