OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libm/] [mathfp/] [sf_isnan.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
 
2
/* @(#)z_isnanf.c 1.0 98/08/13 */
3
/******************************************************************
4
 * isnanf
5
 *
6
 * Input:
7
 *   x - pointer to a floating point value
8
 *
9
 * Output:
10
 *   An integer that indicates if the number is NaN.
11
 *
12
 * Description:
13
 *   This routine returns an integer that indicates if the number
14
 *   passed in is NaN (1) or is finite (0).
15
 *
16
 *****************************************************************/
17
 
18
#include "fdlibm.h"
19
#include "zmath.h"
20
 
21
int
22
_DEFUN (isnanf, (float),
23
        float x)
24
{
25
  __int32_t wx;
26
  int exp;
27
 
28
  GET_FLOAT_WORD (wx, x);
29
  exp = (wx & 0x7f800000) >> 23;
30
 
31
  if ((exp == 0x7f8) && (wx & 0x7fffff))
32
    return (1);
33
  else
34
    return (0);
35
}
36
 
37
 
38
#ifdef _DOUBLE_IS_32BITS
39
 
40
int
41
_DEFUN (isnan, (double),
42
        double x)
43
{
44
  return isnanf((float) x);
45
}
46
 
47
#endif /* defined(_DOUBLE_IS_32BITS) */
48
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.