]> www.ginac.de Git - cln.git/blob - src/float/output/cl_F_printb.cc
Use paths relative the `src' directory in the #include directives.
[cln.git] / src / float / output / cl_F_printb.cc
1 // print_float_binary().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/float_io.h"
8
9
10 // Implementation.
11
12 #include "cln/float.h"
13 #include "float/cl_F.h"
14 #include "cln/integer_io.h"
15 #include "integer/cl_I.h"
16
17 namespace cln {
18
19 void print_float_binary (std::ostream& stream, const cl_F& z)
20 {
21 // Vorzeichen, Punkt, Mantisse (binär), (Zweiersystem-)Exponent (dezimal)
22         cl_idecoded_float m_e_s = integer_decode_float(z);
23         var cl_I& m = m_e_s.mantissa;
24         var cl_I& s = m_e_s.sign;
25         // Vorzeichen ausgeben, falls <0:
26         if (eq(s,-1))
27                 fprintchar(stream,'-');
28         // Mantisse binär(!) ausgeben:
29         fprintchar(stream,'.');
30         print_integer(stream,2,m);
31         // Exponent-Marker ausgeben:
32         {
33                 var char exp_marker;
34                 floattypecase(z
35                 ,       exp_marker = 's';
36                 ,       exp_marker = 'f';
37                 ,       exp_marker = 'd';
38                 ,       exp_marker = 'L';
39                 );
40                 fprintchar(stream,exp_marker);
41         }
42         // Exponenten dezimal ausgeben:
43         print_integer(stream,10,cl_I(float_exponent(z)));
44 }
45
46 }  // namespace cln