]> www.ginac.de Git - cln.git/blob - src/float/ffloat/misc/cl_FF_idecode.cc
Finalize CLN 1.3.7 release.
[cln.git] / src / float / ffloat / misc / cl_FF_idecode.cc
1 // integer_decode_float().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/ffloat.h"
8
9
10 // Implementation.
11
12 #include "float/ffloat/cl_FF.h"
13 #include "integer/cl_I.h"
14
15 namespace cln {
16
17 CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_FF& x)
18 {
19         // x entpacken:
20         var cl_signean sign;
21         var sintL exp;
22         var uint32 mant;
23         FF_decode(x, { return cl_idecoded_float(0, 0, 1); },
24                      sign=,exp=,mant=
25                  );
26         return cl_idecoded_float(
27                 (FF_mant_len+1 < cl_value_len
28                  ? L_to_FN(mant) // Mantisse als Fixnum
29                  : UL_to_I(mant) // oder evtl. als Bignum
30                 ),
31                 L_to_FN(exp-(FF_mant_len+1)), // e-24 als Fixnum
32                 (sign>=0 ? cl_I(1) : cl_I(-1)) // (-1)^s erzeugen
33                );
34 }
35
36 }  // namespace cln