// cl_I_LF_div(). // General includes. #include "cl_sysdep.h" // Specification. #include "cl_LF.h" // Implementation. #include "cln/lfloat.h" #include "cl_LF_impl.h" #include "cln/integer.h" #include "cl_I.h" #include "cl_DS.h" #include "cl_F.h" #include "cl_N.h" namespace cln { const cl_R cl_I_LF_div (const cl_I& x, const cl_LF& y) { // Method: // If x=0, return 0. // Else convert x to a float and divide. // (If x is shorter than y, we would gain nothing by dividing the absolute // value of x by the mantissa of y, since the numerator of the division would // have to have 2*length(y)+1 words, even if length(x) is much smaller than // length(y).) if (eq(x,0)) { return 0; } var uintC len = TheLfloat(y)->len; return cl_I_to_LF(x,len) / y; } // Bit complexity (N = max(length(x),length(y))): O(M(N)). } // namespace cln