copysign(1.0,+2.0) = +1.0 copysign(1.0,-2.0) = -1.0 copysign(INFINITY,-2.0) = -inf copysign(NAN,-2.0) = -nan引用C11 standard (ISO/IEC 9899:2011): 7.12.11.1 The copysign functions (p: 255) 7.25 Type-generic math <tgmath.h> (p: 373-375) F.10.8.1 The copysign functions (p...
std::copysign,std::copysignf,std::copysignl C++ Numerics library Common mathematical functions Defined in header<cmath> (1) floatcopysign(floatmag,floatsgn); doublecopysign(doublemag,doublesgn); longdoublecopysign(longdoublemag,longdoublesgn); ...
copysigncopysignfcopysignl (C++11)(C++11)(C++11) 复制浮点数的符号 (函数) 分类与比较 fpclassify (C++11) 归类给定的浮点数 (函数) isfinite (C++11) 检查给定数是否拥有有限值 (函数) isinf (C++11) 检查给定数是否为无限 (函数) isnan (C++11) 检查给定的数是否 NaN (函数...
copysigncopysignfcopysignl (C++11)(C++11)(C++11) copies the sign of a floating point value (function) Classification and comparison fpclassify (C++11) categorizes the given floating-point value (function) isfinite (C++11) checks if the given number has finite value (function) isinf...
#include <math.h> #include <fenv.h> #pragma STDC FENV_ACCESS ON double round(double x) { fenv_t save_env;feholdexcept(&save_env); double result =rint(x); if (fetestexcept(FE_INEXACT)) {fesetround(FE_TOWARDZERO); result =rint(copysign(0.5 +fabs(x), x)); }feupdateenv(&save...
copysigncopysignfcopysignl (C99)(C99)(C99) 从一个给定值的绝对值和另一个给定值的符号产生值 (函数) 分类及比较 fpclassify (C99) 对给定的浮点数分类 (宏函数) isfinite (C99) 检查给定数是否具有有限值 (宏函数) isinf (C99) 检查给定数是否是无穷大 (宏函数) isnan (C99) 检...
copysign copysignf copysign copysignl erf erff erf erfl erfc erfcf erfc erfcl exp2 exp2f exp2 exp2l expm1 expm1f expm1 expm1l fdim fdimf fdim fdiml floor floorf floor floorl fma fmaf fma fmal fmax fmaxf fmax fmaxl fmin fminf fmin fminl fmod fmodf fmod fmodl fre...
This function detects the sign bit of zeroes, infinities, and NaNs. Along withstd::copysign,std::signbitis one of the only two portable ways to examine the sign of a NaN. The additional overloads are not required to be provided exactly as(A). They only need to be sufficient to ensur...
(const V0& x, const V1& y, rebind_simd_t<int, /*math-common-simd-t*/<V0, V1>>* quo); template<class V0, class V1> constexpr /*math-common-simd-t*/<V0, V1> copysign(const V0& x, const V1& y); template<class V0, class V1> constexpr /*math-common-simd-t*/<...
double modf(double num, double* iptr) { #pragma STDC FENV_ACCESS ON int save_round = std::fegetround(); std::fesetround(FE_TOWARDZERO); *iptr = std::nearbyint(num); std::fesetround(save_round); return std::copysign(std::isinf(num) ? 0.0 : x - (*iptr), num); }...