12 #include "cl_integer.h"
17 #define MAYBE_INLINE inline
18 #include "cl_LF_minusp.cc"
20 const cl_I cl_LF_to_I (const cl_LF& x)
23 // Falls x=0.0, Ergebnis 0.
24 // Sonst (ASH Vorzeichen*Mantisse (e-16n)).
25 var uintL uexp = TheLfloat(x)->expo;
26 if (uexp==0) { return 0; } // x=0.0 -> Ergebnis 0
27 // Mantisse zu einem Integer machen:
31 var uintC len = TheLfloat(x)->len;
32 var uintC len1 = len+1; // brauche 1 Digit mehr
33 num_stack_alloc(len1, MSDptr=,LSDptr=);
34 copy_loop_msp(arrayMSDptr(TheLfloat(x)->data,len),MSDptr mspop 1,len); // Mantisse kopieren
35 mspref(MSDptr,0) = 0; // und zusätzliches Nulldigit
36 // Mantisse ist die UDS MSDptr/len1/LSDptr.
38 // x<0 -> Mantisse negieren:
39 { neg_loop_lsp(LSDptr,len1); }
40 // Vorzeichen*Mantisse ist die DS MSDptr/len1/LSDptr.
41 // (ASH Vorzeichen*Mantisse (- e 16n)) durchführen:
42 return ash(DS_to_I(MSDptr,len1),
43 minus(uexp, LF_exp_mid + intDsize*(uintL)len)