1 #ifndef GCC_DCMPLR_D_REAL_H
2 #define GCC_DCMPLR_D_REAL_H
8 // Including gcc/real.h presents too many problems, so
9 // just statically allocate enough space for
21 long m
[ (16 + sizeof(long))/sizeof(long) + 1 ];
27 static real_t
parse(const char * str
, MyMode mode
);
28 static real_t
getnan(MyMode mode
);
29 static real_t
getinfinity();
31 // This constructor prevent the use of the real_t in a union
33 real_t(const real_t
& r
);
35 const real_value
& rv() const { return * (real_value
*) & frv
; }
36 real_value
& rv() { return * (real_value
*) & frv
; }
37 real_t(const struct real_value
& rv
);
41 real_t
& operator=(const real_t
& r
);
42 real_t
& operator=(int v
);
43 real_t
operator+ (const real_t
& r
);
44 real_t
operator- (const real_t
& r
);
46 real_t
operator* (const real_t
& r
);
47 real_t
operator/ (const real_t
& r
);
48 real_t
operator% (const real_t
& r
);
49 bool operator< (const real_t
& r
);
50 bool operator> (const real_t
& r
);
51 bool operator<= (const real_t
& r
);
52 bool operator>= (const real_t
& r
);
53 bool operator== (const real_t
& r
);
54 bool operator!= (const real_t
& r
);
55 //operator d_uns64(); // avoid bugs, but maybe allow operator bool()
56 d_uns64
toInt() const;
57 d_uns64
toInt(Type
* real_type
, Type
* int_type
) const;
58 real_t
convert(MyMode to_mode
) const;
61 bool floatCompare(int op
, const real_t
& r
);
62 bool isIdenticalTo(const real_t
& r
) const;
63 void format(char * buf
, unsigned buf_size
) const;
64 void formatHex(char * buf
, unsigned buf_size
) const;
68 bool isConversionExact(MyMode to_mode
) const;
69 void toBytes(unsigned char * buf
, unsigned buf_size
);
72 // prevent this from being used
73 real_t
& operator=(float) { return *this; }
74 real_t
& operator=(double) { return *this; }
75 // real_t & operator=(long double v) { return *this; }
79 real_t maxval
, minval
, epsilonval
/*, nanval, infval*/;
80 d_int64 dig
, mant_dig
;
81 d_int64 max_10_exp
, min_10_exp
;
82 d_int64 max_exp
, min_exp
;
85 extern real_t_Properties real_t_properties
[real_t::NumModes
];