]> www.ginac.de Git - cln.git/blob - src/float/misc/cl_F_extendsqrt.cc
2006-04-25 Bruno Haible <bruno@clisp.org>
[cln.git] / src / float / misc / cl_F_extendsqrt.cc
1 // cl_F_extendsqrt().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_F.h"
8
9
10 // Implementation.
11
12 #include "cl_SF.h"
13 #include "cl_LF.h"
14
15 namespace cln {
16
17 const cl_F cl_F_extendsqrt (const cl_F& x)
18 {
19 // Methode:
20 // SF -> FF wegen 17+sqrt(17)+2 = 23.2 < 24
21 // FF -> DF wegen 24+sqrt(24)+2 = 30.9 < 53
22 // DF -> LF(4) wegen 53+sqrt(53)+2 = 62.3 < 64
23 // LF(n) -> LF(n+1) für n<=12 wegen 16n+sqrt(16n)+2 < 16(n+1)
24 // LF(n) -> LF(n+2) für n<=56 wegen 16n+sqrt(16n)+2 < 16(n+2)
25 // LF(n) -> LF(n+4) für n<=240
26 // LF(n) -> LF(n+8) für n<=992
27 // LF(n) -> LF(n+16) für n<=4032
28 // LF(n) -> LF(n+32) für n<=16256
29 // LF(n) -> LF(n+65) für n<=65535
30         floatcase(x
31         ,       if (SF_mant_len+1<=17)
32                         return cl_SF_to_FF(x); // 17+sqrt(17)+2 = 23.2 < 24
33                 else
34                         return cl_SF_to_DF(x); // 24+sqrt(24)+2 = 30.9 < 53
35         ,       return cl_FF_to_DF(x); // 24+sqrt(24)+2 = 30.9 < 53
36         ,       return cl_DF_to_LF(x,ceiling(63,intDsize)); // 53+sqrt(53)+2 = 62.3 < 63
37         ,       return extend(x,cl_LF_len_incsqrt(TheLfloat(x)->len));
38         );
39 }
40
41 }  // namespace cln