15 const cl_SF cl_DF_to_SF (const cl_DF& x)
20 #if (cl_word_size==64)
22 DF_decode(x, { return SF_0; }, sign=,exp=,mant=);
23 // 52-16=36 Bits wegrunden:
24 var const int shiftcount = DF_mant_len-SF_mant_len;
25 if ( ((mant & bit(shiftcount-1)) ==0) // Bit 35 war 0 -> abrunden
26 || ( ((mant & (bit(shiftcount-1)-1)) ==0) // war 1, Bits 34..0 >0 -> aufrunden
28 && ((mant & bit(shiftcount)) ==0)
31 { mant = mant >> shiftcount; }
34 { mant = mant >> shiftcount;
36 if (mant >= bit(SF_mant_len+1))
37 // Überlauf durchs Runden
38 { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben
40 return encode_SF(sign,exp,mant);
44 DF_decode2(x, { return SF_0; }, sign=,exp=,manthi=,mantlo=);
45 // 52-16=36 Bits wegrunden:
46 var const int shiftcount = DF_mant_len-SF_mant_len-32;
47 if ( ((manthi & bit(shiftcount-1)) ==0) // Bit 35 war 0 -> abrunden
48 || ( ((manthi & (bit(shiftcount-1)-1)) ==0) // war 1, Bits 34..0 >0 -> aufrunden
51 && ((manthi & bit(shiftcount)) ==0)
54 { manthi = manthi >> shiftcount; }
57 { manthi = manthi >> shiftcount;
59 if (manthi >= bit(SF_mant_len+1))
60 // Überlauf durchs Runden
61 { manthi = manthi>>1; exp = exp+1; } // Mantisse rechts schieben
63 return encode_SF(sign,exp,manthi);