New test.
[mono.git] / mono / utils / mono-math.c
1
2 #include "mono-math.h"
3
4 #ifndef HAVE_SIGNBIT
5
6 int
7 mono_signbit_float (float x)
8 {
9         union { float f; int i; } u;
10
11         u.f = x;
12
13         return u.i < 0;
14 }
15
16 int
17 mono_signbit_double (double x)
18 {
19         union { double d; int i[2]; } u;
20
21         u.d = x;
22
23 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
24         return u.i [1] < 0;
25 #else
26         return u.i [0] < 0;
27 #endif
28 }
29
30 #endif