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) (计算以2为底的指数函数(函数))

expm1

Compute exponential minus one (function) (计算以e为底数的指数减1(函数))

ilogb

Integer binary logarithm (function) (整数以浮点基数为底的对数(函数))

log1p

Compute logarithm plus one (function) (计算真数加1的和的自然对数(函数))

log2

Compute binary logarithm (function) (计算以2为底数的对数(函数))

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 (巨大的float值)

HUGE_VALL

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

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

macrotypedescription
MATH_ERRNO
MATH_ERREXCEPT
int

Bitmask value with the possible values math_errhandling can take.

math_errhandling可以接受的可能值的位掩码值。)

FP_FAST_FMA
FP_FAST_FMAF
FP_FAST_FMAL
int

Each, 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
int

The possible values returned by fpclassify.

fpclassify返回的可能值。)

FP_ILOGB0
FP_ILOGBNAN
int

Special values the ilogb function may return.

ilogb函数可能返回的特殊值。)

类型 

double_t

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

float_t

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
C++ Standard Library Quick Reference by Peter Van Weert, Marc Gregoire 2016 | ISBN: 1484218752 | English | 206 pages PDF+EPUB This quick reference is a condensed reference guide to the essential data structures, algorithms, and functions provided by the C++ Standard Library. More specifically, this is a compact collection of essential classes and functions, used by C++ programmers on a daily basis. The C++ Standard Library Quick Reference features core classes for strings, I/O streams, and various generic containers, as well as a comprehensive set of algorithms to manipulate them. In recent years, the C++11 and C++14 standards have added even more efficient container classes, a new powerful regular expression library, and a portable multithreading library featuring threads, mutexes, condition variables, and atomic variables. Needless to say, it is hard to know and remember all the possibilities, details, and intricacies of this vast and growing library. This handy reference guide is therefore indispensable to any C++ programmer. It offers a condensed, well-structured summary of all essential aspects of the C++ Standard Library, including all aforementioned functionality. No page-long, repetitive examples or obscure, rarely used features. Instead, everything you need to know and watch out for in practice is outlined in a compact, to-the-point style, interspersed with well-chosen, clarifying examples. The book does not explain the C++ language or syntax, but is accessible to anyone with basic C++ knowledge. Even the most experienced C++ programmer though will learn a thing or two from it and find it a useful memory-aid. What You Will Learn • The essentials that the C++ Standard Library has to offer • How to use containers to efficiently store and retrieve your data • How to use algorithms to inspect and manipulate your data • How lambda expressions allow for elegant use of algorithms • What the standard string class provides and how to use it • What functionality the library provides for file and stream-based I/O • What smart pointers are and how to use them to prevent memory leaks • How to write safe and efficient multi-threaded code using the C++11 threading libraries

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

weixin_40186813

你的能量无可限量。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值