13 #include "cl_R_div_t.h"
15 #if 0 // 2 type dispatches
17 #include "cl_rational.h"
19 #include "cl_R_div_t.h"
21 const cl_R_fdiv_t ftruncate2 (const cl_R& x)
25 var cl_RA_div_t q_r = truncate2(x);
26 var cl_I& q = q_r.quotient;
27 var cl_RA& r = q_r.remainder;
28 return cl_R_fdiv_t(cl_float(q),r);
35 #else // 1 type dispatch
38 #include "cl_integer.h"
39 #include "cl_sfloat.h"
40 #include "cl_ffloat.h"
41 #include "cl_dfloat.h"
42 #include "cl_lfloat.h"
45 const cl_R_fdiv_t ftruncate2 (const cl_R& x)
48 , return cl_R_fdiv_t(cl_float(x),0);
49 , var const cl_I& a = numerator(x);
50 var const cl_I& b = denominator(x);
51 var cl_I_div_t q_r = truncate2(a,b);
52 var cl_I& q = q_r.quotient;
53 var cl_I& r = q_r.remainder;
54 return cl_R_fdiv_t(cl_float(q),I_I_to_RT(r,b));
55 , var cl_SF q = ftruncate(x); return cl_R_fdiv_t(q,x-q);
56 , var cl_FF q = ftruncate(x); return cl_R_fdiv_t(q,x-q);
57 , var cl_DF q = ftruncate(x); return cl_R_fdiv_t(q,x-q);
58 , var cl_LF q = ftruncate(x); return cl_R_fdiv_t(q,LF_LF_minus_LF(x,q));