]> www.ginac.de Git - cln.git/blob - src/float/misc/cl_F_leastneg.cc
Fix compilation with GCC 4.4.
[cln.git] / src / float / misc / cl_F_leastneg.cc
1 // least_negative_float().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/float.h"
8
9 // Implementation.
10
11 #include "float/cl_F.h"
12 #include "float/sfloat/cl_SF.h"
13 #include "float/ffloat/cl_FF.h"
14 #include "float/dfloat/cl_DF.h"
15 #include "float/lfloat/cl_LF.h"
16 #include "float/lfloat/cl_LF_impl.h"
17
18 namespace cln {
19
20 static inline const cl_LF least_negative_LF (uintC len)
21 {
22         var Lfloat erg = allocate_lfloat(len,LF_exp_low,-1);
23         #if CL_DS_BIG_ENDIAN_P
24           TheLfloat(erg)->data[0] = bit(intDsize-1);
25           clear_loop_up(&TheLfloat(erg)->data[1],len-1);
26         #else
27           var uintD* ptr = clear_loop_up(&TheLfloat(erg)->data[0],len-1);
28           *ptr = bit(intDsize-1);
29         #endif
30         return erg;
31 }
32
33 const cl_F least_negative_float (float_format_t f)
34 {
35         // Exponent so klein wie möglich, Mantisse 10...0, Vorzeichen -.
36
37         static const cl_SF least_negative_SF =
38                 make_SF(-1,SF_exp_low,bit(SF_mant_len));
39
40         static const cl_FF least_negative_FF =
41                 encode_FF(-1,FF_exp_low-FF_exp_mid,bit(FF_mant_len));
42
43         static const cl_DF least_negative_DF =
44         #if (cl_word_size==64)
45                 encode_DF(-1,DF_exp_low-DF_exp_mid,bit(DF_mant_len));
46         #else
47                 encode_DF(-1,DF_exp_low-DF_exp_mid,bit(DF_mant_len-32),0);
48         #endif
49
50         floatformatcase((uintC)f
51         ,       return least_negative_SF;
52         ,       return least_negative_FF;
53         ,       return least_negative_DF;
54         ,       return least_negative_LF(len);
55         );
56 }
57
58 }  // namespace cln
59