]> www.ginac.de Git - cln.git/blob - src/float/sfloat/elem/cl_SF_to_I.cc
* All Files have been modified for inclusion of namespace cln;
[cln.git] / src / float / sfloat / elem / cl_SF_to_I.cc
1 // cl_SF_to_I().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_SF.h"
8
9
10 // Implementation.
11
12 #include "cln/integer.h"
13 #include "cl_I.h"
14
15 namespace cln {
16
17 const cl_I cl_SF_to_I (const cl_SF& x)
18 {
19       // x entpacken:
20       var cl_signean sign;
21       var sintL exp;
22       var uint32 mant;
23       SF_decode(x, { return 0; }, sign=,exp=,mant=);
24       exp = exp-(SF_mant_len+1);
25       return ash( L_to_FN(sign==0
26                           ? (sintL)mant // mant als Fixnum >0
27                           : -(sintL)mant // -mant als Fixnum <0
28                          ),
29                   exp
30                 );
31 }
32
33 }  // namespace cln