該函數判斷給定的數字是否正常。如果數字正常,則返回 1,否則返回 0。
用法
假設一個數字是 'x'。語法是:
bool isnormal(float x);
bool isnormal(double x);
bool isnormal(long double x);
bool isnormal(integral x);
參數
x: 它是一個浮點值。
返回值
參數(x) | 返回值 |
---|---|
Infinite | 0 |
正常值 | 1 |
低於正常值 | 0 |
不是數字 | 0 |
例子1
讓我們看一個簡單的例子。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
std::cout << "isnormal(5) is:" <<isnormal(5)<< std::endl;
std::cout << "isnormal(5.0/0.0) is:" <<isnormal(5.0/0.0)<< std::endl;
std::cout << "isnormal(0.0/0.0) is:" <<isnormal(0.0/0.0)<< std::endl;
return 0;
}
輸出:
isnormal(5) is:1 isnormal(5.0/0.0) is:0 isnormal(0.0/0.0) is:0
相關用法
- C++ Math isnan()用法及代碼示例
- C++ Math isgreater()用法及代碼示例
- C++ Math islessgreater()用法及代碼示例
- C++ Math isfinite()用法及代碼示例
- C++ Math isunordered()用法及代碼示例
- C++ Math islessequal()用法及代碼示例
- C++ Math isgreaterequal()用法及代碼示例
- C++ Math isinf()用法及代碼示例
- C++ Math ilogb()用法及代碼示例
- C++ Math scalbn()用法及代碼示例
- C++ Math acosh()用法及代碼示例
- C++ Math asinh()用法及代碼示例
- C++ Math fabs()用法及代碼示例
- C++ Math log2()用法及代碼示例
- C++ Math nearbyint()用法及代碼示例
- C++ Math tan()用法及代碼示例
- C++ Math log()用法及代碼示例
- C++ Math nextafter()用法及代碼示例
- C++ Math fdim()用法及代碼示例
- C++ Math erfc()用法及代碼示例
注:本文由純淨天空篩選整理自 C++ Math isnormal()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。