⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s_isnan.c

📁 用于嵌入式Linux系统的标准C的库函数
💻 C
字号:
/* @(#)z_isnan.c 1.0 98/08/13 *//*FUNCTION        <<isnan>>,<<isnanf>>,<<isinf>>,<<isinff>>,<<finite>>,<<finitef>>---testfor exceptional numbersINDEX        isnanINDEX        isinfINDEX        finiteINDEX        isnanfINDEX        isinffINDEX        finitefANSI_SYNOPSIS        #include <ieeefp.h>        int isnan(double <[arg]>);        int isinf(double <[arg]>);        int finite(double <[arg]>);        int isnanf(float <[arg]>);        int isinff(float <[arg]>);        int finitef(float <[arg]>);TRAD_SYNOPSIS        #include <ieeefp.h>        int isnan(<[arg]>)        double <[arg]>;        int isinf(<[arg]>)        double <[arg]>;        int finite(<[arg]>);        double <[arg]>;        int isnanf(<[arg]>);        float <[arg]>;        int isinff(<[arg]>);        float <[arg]>;        int finitef(<[arg]>);        float <[arg]>;DESCRIPTION        These functions provide information on the floating-point        argument supplied.        There are five major number formats -        o+        o zero         a number which contains all zero bits.        o subnormal         Is used to represent  number with a zero exponent, but a nonzero fraction.         o normal          A number with an exponent, and a fraction        o infinity          A number with an all 1's exponent and a zero fraction.        o NAN          A number with an all 1's exponent and a nonzero fraction.        o-        <<isnan>> returns 1 if the argument is a nan. <<isinf>>        returns 1 if the argument is infinity.  <<finite>> returns 1 if the        argument is zero, subnormal or normal.        The <<isnanf>>, <<isinff>> and <<finitef>> perform the same        operations as their <<isnan>>, <<isinf>> and <<finite>>        counterparts, but on single-precision floating-point numbers.QUICKREF        isnan - pureQUICKREF        isinf - pureQUICKREF        finite - pureQUICKREF        isnan - pureQUICKREF        isinf - pureQUICKREF        finite - pure*//****************************************************************** * isnan * * Input: *   x - pointer to a floating-point value * * Output: *   An integer that indicates if the number is NaN. * * Description: *   This routine returns an integer that indicates if the number *   passed in is NaN (1) or is finite (0). * *****************************************************************/#include "fdlibm.h"#include "zmath.h"#ifndef _DOUBLE_IS_32BITSint isnan (double x){  __uint32_t lx, hx;  int exp;  EXTRACT_WORDS (hx, lx, x);  exp = (hx & 0x7ff00000) >> 20;  if ((exp == 0x7ff) && (hx & 0xf0000 || lx))    return (1);  else    return (0);}#endif /* _DOUBLE_IS_32BITS */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -