14 cl_heap_dfloat* cl_double_to_DF_pointer (const dfloatjanus& val_)
16 var dfloat val = val_.eksplicit;
17 #if (cl_word_size==64)
18 var uintL exp = (val >> DF_mant_len) & (bit(DF_exp_len)-1); // e
19 if (exp == 0) // e=0 ?
20 // vorzeichenbehaftete 0.0 oder subnormale Zahl
21 { if (!((val << 1) == 0) && underflow_allowed())
22 { throw floating_point_underflow_exception(); }
24 { return cl_DF_0; } // +/- 0.0 -> 0.0
26 elif (exp == 2047) // e=2047 ?
27 { if (!((val << (64-DF_mant_len)) == 0))
28 { throw floating_point_nan_exception(); } // NaN
30 { throw floating_point_overflow_exception(); } // Infinity, Overflow
33 { // Der Exponent muß um DF_exp_mid-1022 erhöht werden.
34 if ((DF_exp_mid>1022) && (exp > DF_exp_high-DF_exp_mid+1022))
35 { throw floating_point_overflow_exception(); } // Overflow
36 val += (sint64)(DF_exp_mid - 1022) << DF_mant_len;
37 return allocate_dfloat(val);
40 var uintL exp = (val.semhi >> (DF_mant_len-32)) & (bit(DF_exp_len)-1); // e
41 if (exp == 0) // e=0 ?
42 // vorzeichenbehaftete 0.0 oder subnormale Zahl
43 { if (!(((val.semhi << 1) == 0) && (val.mlo == 0)) && underflow_allowed())
44 { throw floating_point_underflow_exception(); }
46 { return cl_DF_0; } // +/- 0.0 -> 0.0
48 elif (exp == 2047) // e=2047 ?
49 { if (!(((val.semhi << (64-DF_mant_len)) == 0) && (val.mlo == 0)))
50 { throw floating_point_nan_exception(); } // NaN
52 { throw floating_point_overflow_exception(); } // Infinity, Overflow
55 { // Der Exponent muß um DF_exp_mid-1022 erhöht werden.
56 if ((DF_exp_mid>1022) && (exp > DF_exp_high-DF_exp_mid+1022))
57 { throw floating_point_overflow_exception(); } // Overflow
58 val.semhi += (sint32)(DF_exp_mid - 1022) << (DF_mant_len-32);
59 return allocate_dfloat(val.semhi,val.mlo);