4 #include "base/cl_sysdep.h"
7 #include "cln/ffloat.h"
12 #include "float/ffloat/cl_FF.h"
16 float float_approx (const cl_FF& obj)
18 union { ffloat eksplicit; float machine_float; } u;
19 #define val u.eksplicit
20 val = cl_ffloat_value(obj);
21 // Der Exponent muß um FF_exp_mid-126 erniedrigt werden.
23 { var uintL exp = (val >> FF_mant_len) & (bit(FF_exp_len)-1); // e
24 if (exp < FF_exp_mid-126+1)
25 { // produziere denormalisiertes Float
26 val = (val & minus_bit(FF_exp_len+FF_mant_len)) // selbes Vorzeichen
27 | (0 << FF_mant_len) // Exponent 0
28 | (((val & (bit(FF_mant_len)-1)) | bit(FF_mant_len)) // Mantisse shiften
29 >> (FF_exp_mid-126+1 - exp) // shiften
33 { val -= (FF_exp_mid - 126) << FF_mant_len; }
36 return u.machine_float;