]> www.ginac.de Git - cln.git/blob - src/float/ffloat/conv/cl_FF_to_floatj.cc
* All Files have been modified for inclusion of namespace cln;
[cln.git] / src / float / ffloat / conv / cl_FF_to_floatj.cc
1 // cl_FF_to_float().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_FF.h"
8
9 namespace cln {
10
11 // Implementation.
12
13 void cl_FF_to_float (const cl_FF& obj, ffloatjanus* val_)
14 {
15         var ffloat val = cl_ffloat_value(obj);
16         // Der Exponent muß um FF_exp_mid-126 erniedrigt werden.
17         if (FF_exp_mid>126)
18           { var uintL exp = (val >> FF_mant_len) & (bit(FF_exp_len)-1); // e
19             if (exp < FF_exp_mid-126+1)
20               { // produziere denormalisiertes Float
21                 val = (val & minus_bit(FF_exp_len+FF_mant_len)) // selbes Vorzeichen
22                       | (0 << FF_mant_len) // Exponent 0
23                       | (((val & (bit(FF_mant_len)-1)) | bit(FF_mant_len)) // Mantisse shiften
24                          >> (FF_exp_mid-126+1 - exp) // shiften
25                         );
26               }
27               else
28               { val -= (FF_exp_mid - 126) << FF_mant_len; }
29           }
30         val_->eksplicit = val;
31 }
32
33 }  // namespace cln