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


    C++官网参考链接:https://cplusplus.com/reference/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) (浮点类型(类型))

  • 相关阅读:
    STL 概念
    P1586 四方定理-完全背包(dp)
    SiC市场变革:全球供应链竞争激烈 | 百能云芯
    相似文本聚类与调参
    Lazada、速卖通、亚马逊等跨境平台自养买家号测评的用处及解析
    自定义MVC【第一章】
    代码随想录1.5——数组:35搜索插入位置、34在排序数组中查找元素的第一个和最后一个位置、26.删除排序数组中的重复项、283移动零
    django setting.py中的SECRET_KEY
    Electron常见问题 64 - Electron的升级安装包会下载到本地哪个目录?
    hadoop04--Kafka集群环境搭建
  • 原文地址:https://blog.csdn.net/weixin_40186813/article/details/127026849