C++ Math isnan()2024年8月30日 | 阅读 1 分钟 该函数检查一个数是否为“非数字”(Not a Number)。如果该数是 NaN,则返回 1,否则返回 0。 注意:NaN 是一个用于浮点数元素的不可表示的值,例如负数的平方根或 0/0 的结果。语法假设一个数是 'x'。语法是 参数x:它是一个浮点值。 返回值如果 x 是 NaN,则返回 1,否则返回 0。 示例 1让我们看一个简单的例子,当 x 的值为 0.0/0.0 时。 输出 value of x is : -nan isnan(x) : 1 在此示例中,isnan(x) 确定 x 的值是 nan。因此,它返回 1。 示例 2让我们看一个简单的例子,当 x 的值为 4.3 时。 输出 value of x is : 4.3 isnan(x) : 0 在此示例中,isnan(x) 函数确定 x 的值不是 'nan'。因此,它返回值 0。 下一主题C++ 数学函数 |
C++ Math remainder() 该函数查找 numerator/denominator 的浮点余数(四舍五入到最接近的整数值)。余数公式:Remainder = numerator - (r*denominator),其中 r = numerator/denominator,并将其四舍五入到最接近的整数值。语法 考虑一个分子 'n' 和分母 'd'。语法将是:return_type...
阅读1分钟
C++ 数学函数 fmax() 该函数返回两个数字中的最大值。条件:考虑两个数字 'x' 和 'y'。如果 (x > y):它返回 x。如果 (y > x):它返回 y。如果 (x = nan):它返回 y。如果 (y = nan):它返回 x。语法 float fmax(float x, float y); double fmax(double x, double y); long double fmax(long double x, long double y); 提升的 fmax(type1 x, type2 y); 数学...
阅读1分钟
C++ Math lgamma() lgamma() 函数计算传递给该函数的参数的伽马函数的对数。假设一个数为 x: 语法 float lgamma(float x); double lgamma(double x); long double lgamma(long double x); double lgamma(integral x); 参数 x:它是一个浮点值。 返回值 它返回一个伽马的对数...
阅读 2 分钟
C++ Math after() after() 函数表示特定方向上的可表示值。假设有两个数字 'from' 和 'to'。因此,after() 函数在 'to' 的方向上找到 'from' 的值。语法 float after( float from, float to); double after( double from, double to); long double...
阅读 2 分钟
C++ Math floor() 它将值四舍五入到不大于给定值的最接近整数。例如:floor(8.2)=8.0; floor(-8.8)=-9.0; 语法 假设数字为 'x'。语法将是:double floor(double x); 参数 x:它是四舍五入到最接近整数的值。返回值 它返回四舍五入后的值...
阅读1分钟
C++ Math tanh() 该函数计算给定角度(以弧度表示)的双曲正切。数学上,tanhx = (ex - e-x) / (ex + e-x) 语法 假设角度是 'x':float tanh(float x); double tanh(double x); long double tanh(long double x); double tanh(integral x); 参数 x:要计算双曲正切的值。返回值 它返回双曲正切...
阅读1分钟
C++ 数学 fmin() 该函数返回两个数字之间的最小值。条件:考虑两个数字 'x' 和 'y'。如果 (x: 它返回 x。如果 (x>y): 它返回 y。如果 (x=nan): 它返回 y。如果 (y=nan): 它返回 x。语法 float fmin(float x, float y); double fmin(double x, double y); long double fmin(long double x, long double y); promoted fmin(Arithmetic x, Arithmetic y); 注意:...
阅读1分钟
C++ Math lround() 此函数用于将给定值四舍五入并转换为长整型。语法 假设一个数字是 'x'。语法为:long int lround(data_type x); 参数 x:可以是 float 或 double 的值。返回值 它返回 x 的四舍五入值。返回类型...
阅读1分钟
C++ 数学 atanh() 该函数计算给定弧度的反双曲正切。其中,反双曲正切是双曲正切的逆运算。tanh-1x =atanh(x) 语法 假设给定弧度角为 'x':float atanh(float x); double atanh(double x); long double atanh(long double x); double atanh(integral x); 注意:返回类型...
阅读 2 分钟
C++ Math isnormal() 该函数确定给定的数是否是正常的(normal)。如果该数是正常的,则返回 1,否则返回 0。 语法 假设一个数为 'x'。语法将是: bool isnormal(float x); bool isnormal(double x); bool isnormal(long double x); bool isnormal(integral x); 参数 x:它...
阅读1分钟
我们请求您订阅我们的新闻通讯以获取最新更新。
我们提供所有技术(如 Java 教程、Android、Java 框架)的教程和面试问题
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India