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