Subversion Repositories HelenOS-historic

Rev

Rev 647 | Rev 653 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 647 Rev 652
Line 81... Line 81...
81
 
81
 
82
/* Conversion functions */
82
/* Conversion functions */
83
 
83
 
84
/* Comparison functions */
84
/* Comparison functions */
85
 
85
 
-
 
86
/* a<b .. -1
-
 
87
 * a=b ..  0
-
 
88
 * a>b ..  1
-
 
89
 * */
-
 
90
 
-
 
91
int __cmpsf2(double a, double b)
-
 
92
{
-
 
93
    float32 fa,fb;
-
 
94
    fa.f=a;
-
 
95
    fb.f=b;
-
 
96
    if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) {
-
 
97
        return 1; /* no special constant for unordered - maybe signaled? */
-
 
98
    };
-
 
99
 
-
 
100
   
-
 
101
    if (isFloat32eq(fa,fb)) {
-
 
102
        return 0;
-
 
103
    };
-
 
104
   
-
 
105
    if (isFloat32lt(fa,fb)) {
-
 
106
        return -1;
-
 
107
        };
-
 
108
    return 1;
-
 
109
}
-
 
110
 
-
 
111
int __unordsf2(float a, float b)
-
 
112
{
-
 
113
    float32 fa,fb;
-
 
114
    fa.f=a;
-
 
115
    fb.f=b;
-
 
116
    return ((isFloat32NaN(fa))||(isFloat32NaN(fb)));
-
 
117
};
-
 
118
 
-
 
119
/**
-
 
120
 * @return zero, if neither argument is a NaN and are equal
-
 
121
 * */
-
 
122
int __eqsf2(float a, float b)
-
 
123
{
-
 
124
    float32 fa,fb;
-
 
125
    fa.f=a;
-
 
126
    fb.f=b;
-
 
127
    if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) {
-
 
128
        /* TODO: sigNaNs*/
-
 
129
        return 1;
-
 
130
        };
-
 
131
    return isFloat32eq(fa,fb)-1;
-
 
132
};
-
 
133
 
-
 
134
/* strange behavior, but it was in gcc documentation */
-
 
135
int __nesf2(float a, float b)
-
 
136
{
-
 
137
    return __eqsf2(a,b);
-
 
138
};
86
/* Other functions */
139
/* Other functions */
87
 
140