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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libm/] [common/] [s_isnand.c] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 * ====================================================
3
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4
 *
5
 * Developed at SunPro, a Sun Microsystems, Inc. business.
6
 * Permission to use, copy, modify, and distribute this
7
 * software is freely granted, provided that this notice
8
 * is preserved.
9
 * ====================================================
10
 */
11
 
12
/*
13
FUNCTION
14
        <<isnan>>, <<isnanf>>, <<isinf>>, <<isinff>>, <<finite>>, <<finitef>>---test for exceptional numbers
15
 
16
INDEX
17
        isnan
18
INDEX
19
        isinf
20
INDEX
21
        finite
22
 
23
INDEX
24
        isnanf
25
INDEX
26
        isinff
27
INDEX
28
        finitef
29
 
30
ANSI_SYNOPSIS
31
        #include <ieeefp.h>
32
        int isnan(double <[arg]>);
33
        int isinf(double <[arg]>);
34
        int finite(double <[arg]>);
35
        int isnanf(float <[arg]>);
36
        int isinff(float <[arg]>);
37
        int finitef(float <[arg]>);
38
 
39
TRAD_SYNOPSIS
40
        #include <ieeefp.h>
41
        int isnan(<[arg]>)
42
        double <[arg]>;
43
        int isinf(<[arg]>)
44
        double <[arg]>;
45
        int finite(<[arg]>);
46
        double <[arg]>;
47
        int isnanf(<[arg]>);
48
        float <[arg]>;
49
        int isinff(<[arg]>);
50
        float <[arg]>;
51
        int finitef(<[arg]>);
52
        float <[arg]>;
53
 
54
 
55
DESCRIPTION
56
        These functions provide information on the floating-point
57
        argument supplied.
58
 
59
        There are five major number formats:
60
        o+
61
        o zero
62
          A number which contains all zero bits.
63
        o subnormal
64
          A number with a zero exponent but a nonzero fraction.
65
        o normal
66
          A number with an exponent and a fraction.
67
        o infinity
68
          A number with an all 1's exponent and a zero fraction.
69
        o NAN
70
          A number with an all 1's exponent and a nonzero fraction.
71
 
72
        o-
73
 
74
        <<isnan>> returns 1 if the argument is a nan. <<isinf>>
75
        returns 1 if the argument is infinity.  <<finite>> returns 1 if the
76
        argument is zero, subnormal or normal.
77
 
78
        Note that by the C99 standard, <<isnan>> and <<isinf>> are macros
79
        taking any type of floating-point and are declared in
80
        <<math.h>>.  Newlib has chosen to declare these as macros in
81
        <<math.h>> and as functions in <<ieeefp.h>>.
82
 
83
        The <<isnanf>>, <<isinff>> and <<finitef>> functions perform the same
84
        operations as their <<isnan>>, <<isinf>> and <<finite>>
85
        counterparts, but on single-precision floating-point numbers.
86
 
87
QUICKREF
88
        isnan - pure
89
QUICKREF
90
        isinf - pure
91
QUICKREF
92
        finite - pure
93
QUICKREF
94
        isnan - pure
95
QUICKREF
96
        isinf - pure
97
QUICKREF
98
        finite - pure
99
*/
100
 
101
/*
102
 * __isnand(x) returns 1 is x is nan, else 0;
103
 * no branching!
104
 */
105
 
106
#include "fdlibm.h"
107
 
108
#ifndef _DOUBLE_IS_32BITS
109
 
110
int
111
_DEFUN (__isnand, (x),
112
        double x)
113
{
114
        __int32_t hx,lx;
115
        EXTRACT_WORDS(hx,lx,x);
116
        hx &= 0x7fffffff;
117
        hx |= (__uint32_t)(lx|(-lx))>>31;
118
        hx = 0x7ff00000 - hx;
119
        return (int)(((__uint32_t)(hx))>>31);
120
}
121
 
122
#endif /* _DOUBLE_IS_32BITS */

powered by: WebSVN 2.1.0

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