1 | #if !defined(WINFUNCS_H) |
---|
2 | #define WINFUNCS_H |
---|
3 | /* winFuncs.h |
---|
4 | Definitions for missing math lib functions |
---|
5 | Andrew Jackson, October 2007 |
---|
6 | */ |
---|
7 | |
---|
8 | double fmax(double x, double y); |
---|
9 | //long double fmaxl (long double x, long double y); |
---|
10 | //float fmaxf (float x, float y); |
---|
11 | |
---|
12 | double fmin(double x, double y); |
---|
13 | |
---|
14 | double trunc(double x); |
---|
15 | //long double truncl(long double x); |
---|
16 | //float truncf(float x); |
---|
17 | |
---|
18 | double erf(double x); |
---|
19 | //long double erfl(long double x); |
---|
20 | //float erff (float x); |
---|
21 | //double erfc(double x); |
---|
22 | //long double erfcl(long double x); |
---|
23 | //float erfcf(float x; |
---|
24 | |
---|
25 | |
---|
26 | // Define INFINITY and NAN |
---|
27 | typedef union { unsigned char __c[4]; float __f; } __huge_valf_t; |
---|
28 | |
---|
29 | # if __BYTE_ORDER == __BIG_ENDIAN |
---|
30 | # define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } |
---|
31 | # endif |
---|
32 | # if __BYTE_ORDER == __LITTLE_ENDIAN |
---|
33 | # define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f } |
---|
34 | # endif |
---|
35 | |
---|
36 | static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; |
---|
37 | # define INFINITY (__huge_valf.__f) |
---|
38 | |
---|
39 | |
---|
40 | # if __BYTE_ORDER == __BIG_ENDIAN |
---|
41 | # define __nan_bytes { 0x7f, 0xc0, 0, 0 } |
---|
42 | # endif |
---|
43 | # if __BYTE_ORDER == __LITTLE_ENDIAN |
---|
44 | # define __nan_bytes { 0, 0, 0xc0, 0x7f } |
---|
45 | # endif |
---|
46 | |
---|
47 | static union { unsigned char __c[4]; float __d; } __nan_union; |
---|
48 | # define NAN (__nan_union.__d) |
---|
49 | |
---|
50 | #endif |
---|