17 const cl_FF cl_DF_to_FF (const cl_DF& x)
22 #if (cl_word_size==64)
24 DF_decode(x, { return cl_FF_0; }, sign=,exp=,mant=);
25 // 52-23=29 Bits wegrunden:
26 var const int shiftcount = DF_mant_len-FF_mant_len;
27 if ( ((mant & bit(shiftcount-1)) ==0) // Bit 28 war 0 -> abrunden
28 || ( ((mant & (bit(shiftcount-1)-1)) ==0) // war 1, Bits 27..0 >0 -> aufrunden
30 && ((mant & bit(shiftcount)) ==0)
33 { mant = mant >> shiftcount; }
36 { mant = mant >> shiftcount;
38 if (mant >= bit(FF_mant_len+1))
39 // Überlauf durchs Runden
40 { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben
42 return encode_FF(sign,exp,mant);
46 DF_decode2(x, { return cl_FF_0; }, sign=,exp=,manthi=,mantlo=);
47 // 52-23=29 Bits wegrunden:
48 var const int shiftcount = DF_mant_len-FF_mant_len;
49 manthi = (manthi << (32-shiftcount)) | (mantlo >> shiftcount);
50 if ( ((mantlo & bit(shiftcount-1)) ==0) // Bit 28 war 0 -> abrunden
51 || ( ((mantlo & (bit(shiftcount-1)-1)) ==0) // war 1, Bits 27..0 >0 -> aufrunden
53 && ((mantlo & bit(shiftcount)) ==0)
60 if (manthi >= bit(FF_mant_len+1))
61 // Überlauf durchs Runden
62 { manthi = manthi>>1; exp = exp+1; } // Mantisse rechts schieben
64 return encode_FF(sign,exp,manthi);