7 #include "cln/sfloat.h"
16 const cl_SF ftruncate (const cl_SF& x)
19 // x = 0.0 oder e<=0 -> Ergebnis 0.0
20 // 1<=e<=16 -> letzte (17-e) Bits der Mantisse auf 0 setzen,
21 // Exponent und Vorzeichen beibehalten
22 // e>=17 -> Ergebnis x
23 var uintL uexp = SF_uexp(x); // e + SF_exp_mid
24 if (uexp <= SF_exp_mid) // 0.0 oder e<=0 ?
27 { if (uexp > SF_exp_mid+SF_mant_len) // e > 16 ?
30 { return cl_SF_from_word(
31 x.word & // Bitmaske: Bits 16-e..0 gelöscht, alle anderen gesetzt
32 ~(bit(SF_mant_len+SF_mant_shift + 1+SF_exp_mid-uexp) - bit(SF_mant_shift))