C++ Math isnormal()
 
 
 C++ Math isnormal()
 
 该函数确定给定数字是否正常。如果数字是正常的,则返回1,否则返回0。
 
语法
 
 假设数字为'x'。语法为: 
 
 
 
  bool  isnormal(float x);
bool  isnormal(double x);
bool  isnormal(long double x);
bool  isnormal(integral x);
 
   
  
参数
 
  x : 它是浮点值。
 
返回值
 
 
 
   
   | 参数(x) | 返回值 | 
 
   
   | 无限 | 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