1 // cl_LF_shortenwith().
15 #define MAYBE_INLINE2 inline
16 #include "cl_LF_precision.cc"
18 #define MAYBE_INLINE inline
19 #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 sintL ey = float_exponent(y);
29 var sintL ex = float_exponent(x);
30 var uintL dx = float_precision(x);
31 if (dx==0) // zerop(x) ?
33 var sintL 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);