7 #include "cln/lfloat.h"
13 #include "cl_LF_impl.h"
18 const cl_LF scale_float (const cl_LF& x, sintL delta)
21 // delta=0 -> x als Ergebnis
22 // x=0.0 -> x als Ergebnis
23 // delta muß ein Integer betragsmäßig <= LF_exp_high-LF_exp_low sein.
24 // Neues LF mit um delta vergrößertem Exponenten bilden.
25 if (delta == 0) { return x; } // delta=0 -> x als Ergebnis
26 var uintL uexp = TheLfloat(x)->expo;
27 if (uexp==0) { return x; }
28 var uintL udelta = delta;
31 if ( ((uexp = uexp+udelta) < udelta) // Exponent-Überlauf?
32 || (uexp > LF_exp_high) // oder Exponent zu groß?
34 { cl_error_floating_point_overflow(); }
36 // delta <0, udelta = 2^32+delta
37 if ( ((uexp = uexp+udelta) >= udelta) // oder Exponent-Unterlauf?
38 || (uexp < LF_exp_low) // oder Exponent zu klein?
40 { cl_error_floating_point_underflow(); }
42 var uintC len = TheLfloat(x)->len;
43 return encode_LFu(TheLfloat(x)->sign,uexp,arrayMSDptr(TheLfloat(x)->data,len),len);