Monte Carlo eXtreme (MCX)
mcx_ieee754.h
Go to the documentation of this file.
1 /***************************************************************************/
25 /***************************************************************************/
31 #ifndef MCX_IEEE754_H
32 #define MCX_IEEE754_H
33 
34 #define MCX_LITTLE_ENDIAN 0x41424344UL
35 #define MCX_BIG_ENDIAN 0x44434241UL
36 #define MCX_PDP_ENDIAN 0x42414443UL
37 #define MCX_BYTE_ORDER ('ABCD')
38 
40  double d;
41 
42  /* This is the IEEE 754 double-precision format. */
43  struct {
44 #if MCX_BYTE_ORDER == MCX_BIG_ENDIAN
45  unsigned int negative: 1;
46  unsigned int exponent: 11;
47  /* Together these comprise the mantissa. */
48  unsigned int mantissa0: 20;
49  unsigned int mantissa1: 32;
50 #else
51  /* Together these comprise the mantissa. */
52  unsigned int mantissa1: 32;
53  unsigned int mantissa0: 20;
54  unsigned int exponent: 11;
55  unsigned int negative: 1;
56 #endif /* Little endian. */
57  } ieee;
58 
59  /* This format makes it easier to see if a NaN is a signalling NaN. */
60  struct {
61 #if MCX_BYTE_ORDER == MCX_BIG_ENDIAN
62  unsigned int negative: 1;
63  unsigned int exponent: 11;
64  unsigned int quiet_nan: 1;
65  /* Together these comprise the mantissa. */
66  unsigned int mantissa0: 19;
67  unsigned int mantissa1: 32;
68 #else
69  /* Together these comprise the mantissa. */
70  unsigned int mantissa1: 32;
71  unsigned int mantissa0: 19;
72  unsigned int quiet_nan: 1;
73  unsigned int exponent: 11;
74  unsigned int negative: 1;
75 #endif
76  } ieee_nan;
77 };
78 
79 #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
80 
81 #endif
Definition: mcx_ieee754.h:39