1 // integer_decode_float().
4 #include "base/cl_sysdep.h"
7 #include "cln/lfloat.h"
12 #include "float/lfloat/cl_LF.h"
13 #include "integer/cl_I.h"
14 #include "base/digitseq/cl_DS.h"
18 CL_INLINE const cl_idecoded_float CL_INLINE_DECL(integer_decode_float) (const cl_LF& x)
21 var uintE uexp = TheLfloat(x)->expo;
23 { return cl_idecoded_float(0, 0, 1); }
24 var cl_signean sign = TheLfloat(x)->sign;
25 var uintC len = TheLfloat(x)->len;
26 // intDsize*len >= 53 >= 33 >= cl_value_len, also len >= bn_minlength.
27 // Baue Integer für die Mantisse.
28 // Vorne 1 Nulldigit, damit es eine NDS wird.
29 var Bignum mant = allocate_bignum(1+len);
30 mspref(arrayMSDptr(TheBignum(mant)->data,1+len),0) = 0;
31 copy_loop_msp(arrayMSDptr(TheLfloat(x)->data,len),arrayMSDptr(TheBignum(mant)->data,1+len) mspop 1,len); // NUDS kopieren
32 return cl_idecoded_float(
35 // e-intDsize*n = uexp-LF_exp_mid-intDsize*n als Integer
36 minus(uexp, LF_exp_mid + intDsize*len),
37 (sign>=0 ? cl_I(1) : cl_I(-1)) // (-1)^s erzeugen