]> www.ginac.de Git - cln.git/blob - src/float/lfloat/misc/cl_LF_decode.cc
d3889e9eafec8e345caeb5f8196277b45b554619
[cln.git] / src / float / lfloat / misc / cl_LF_decode.cc
1 // decode_float().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_lfloat.h"
8
9
10 // Implementation.
11
12 #include "cl_LF.h"
13 #include "cl_LF_impl.h"
14 #include "cl_I.h"
15
16 const cl_decoded_lfloat decode_float (const cl_LF& x)
17 {
18         // x entpacken:
19         var cl_signean sign;
20         var sintL exp;
21         var uintC mantlen;
22         var const uintD* mantMSDptr;
23         LF_decode(x, { return cl_decoded_lfloat(x, 0, encode_LF1(mantlen)); },
24                      sign=,exp=,mantMSDptr=,mantlen=,);
25         return cl_decoded_lfloat(
26                 encode_LFu(0,0+LF_exp_mid,mantMSDptr,mantlen), // (-1)^0 * 2^0 * m erzeugen
27                 L_to_I(exp), // e als Fixnum
28                 encode_LF1s(sign,mantlen) // (-1)^s erzeugen
29                );
30 }