]> www.ginac.de Git - cln.git/blob - src/float/lfloat/elem/cl_I_LF_div.cc
bump library version, since CLN doesn't export global object ctors any more.
[cln.git] / src / float / lfloat / elem / cl_I_LF_div.cc
1 // cl_I_LF_div().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_LF.h"
8
9
10 // Implementation.
11
12 #include "cln/lfloat.h"
13 #include "cl_LF_impl.h"
14 #include "cln/integer.h"
15 #include "cl_I.h"
16 #include "cl_DS.h"
17 #include "cl_F.h"
18 #include "cl_N.h"
19
20 namespace cln {
21
22 const cl_R cl_I_LF_div (const cl_I& x, const cl_LF& y)
23 {
24 // Method:
25 // If x=0, return 0.
26 // Else convert x to a float and divide.
27 // (If x is shorter than y, we would gain nothing by dividing the absolute
28 // value of x by the mantissa of y, since the numerator of the division would
29 // have to have 2*length(y)+1 words, even if length(x) is much smaller than
30 // length(y).)
31         if (eq(x,0)) { return 0; }
32         var uintC len = TheLfloat(y)->len;
33         return cl_I_to_LF(x,len) / y;
34 }
35 // Bit complexity (N = max(length(x),length(y))): O(M(N)).
36
37 }  // namespace cln