1 // cl_LF_shortenwith().
13 #define MAYBE_INLINE2 inline
14 #include "cl_LF_precision.cc"
16 #define MAYBE_INLINE inline
17 #include "cl_LF_exponent.cc"
21 const cl_LF cl_LF_shortenwith (const cl_LF& x, const cl_LF& y)
24 // x = 0.0 -> Precision egal, return x.
25 // ex := float_exponent(x), dx := float_digits(x), 1 ulp(x) = 2^(ex-dx).
26 // ey := float_exponent(y).
27 // Falls ex-dx < ey, x von Precision dx auf ex-ey verkürzen.
28 var sintE ey = float_exponent(y);
29 var sintE ex = float_exponent(x);
30 var uintC dx = float_precision(x);
31 if (dx==0) // zerop(x) ?
33 var sintE ulpx = ex - dx;
34 if ((ex<0 && ulpx>=0) // underflow?
36 ) { // Now ex-dx < ey, hence ex-ey < dx.
39 new_dx = intDsize*LF_minlen;
40 else if ((new_dx = ex - ey) < intDsize*LF_minlen)
41 new_dx = intDsize*LF_minlen;
42 var uintL len = ceiling(new_dx,intDsize);
43 if (intDsize*len < dx)
44 return shorten(x,len);