intervals 0.3.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.txt +1 -0
- data/ext/crlibm/AUTHORS +2 -0
- data/ext/crlibm/COPYING +504 -0
- data/ext/crlibm/ChangeLog +80 -0
- data/ext/crlibm/INSTALL +182 -0
- data/ext/crlibm/Makefile.am +84 -0
- data/ext/crlibm/Makefile.in +530 -0
- data/ext/crlibm/NEWS +0 -0
- data/ext/crlibm/README +31 -0
- data/ext/crlibm/TODO +47 -0
- data/ext/crlibm/VERSION +1 -0
- data/ext/crlibm/aclocal.m4 +989 -0
- data/ext/crlibm/atan-itanium.c +846 -0
- data/ext/crlibm/atan-pentium.c +261 -0
- data/ext/crlibm/atan_accurate.c +244 -0
- data/ext/crlibm/atan_accurate.h +191 -0
- data/ext/crlibm/atan_fast.c +324 -0
- data/ext/crlibm/atan_fast.h +678 -0
- data/ext/crlibm/config.guess +1461 -0
- data/ext/crlibm/config.sub +1566 -0
- data/ext/crlibm/configure +7517 -0
- data/ext/crlibm/configure.ac +364 -0
- data/ext/crlibm/crlibm.h +125 -0
- data/ext/crlibm/crlibm_config.h +149 -0
- data/ext/crlibm/crlibm_config.h.in +148 -0
- data/ext/crlibm/crlibm_private.c +293 -0
- data/ext/crlibm/crlibm_private.h +658 -0
- data/ext/crlibm/csh_fast.c +631 -0
- data/ext/crlibm/csh_fast.h +771 -0
- data/ext/crlibm/double-extended.h +496 -0
- data/ext/crlibm/exp-td.c +962 -0
- data/ext/crlibm/exp-td.h +685 -0
- data/ext/crlibm/exp_accurate.c +197 -0
- data/ext/crlibm/exp_accurate.h +85 -0
- data/ext/crlibm/gappa/log-de-E0-logir0.gappa +106 -0
- data/ext/crlibm/gappa/log-de-E0.gappa +79 -0
- data/ext/crlibm/gappa/log-de.gappa +81 -0
- data/ext/crlibm/gappa/log-td-E0-logir0.gappa +126 -0
- data/ext/crlibm/gappa/log-td-E0.gappa +143 -0
- data/ext/crlibm/gappa/log-td-accurate-E0-logir0.gappa +230 -0
- data/ext/crlibm/gappa/log-td-accurate-E0.gappa +213 -0
- data/ext/crlibm/gappa/log-td-accurate.gappa +217 -0
- data/ext/crlibm/gappa/log-td.gappa +156 -0
- data/ext/crlibm/gappa/trigoSinCosCase3.gappa +204 -0
- data/ext/crlibm/gappa/trigoTanCase2.gappa +73 -0
- data/ext/crlibm/install-sh +269 -0
- data/ext/crlibm/log-de.c +431 -0
- data/ext/crlibm/log-de.h +732 -0
- data/ext/crlibm/log-td.c +852 -0
- data/ext/crlibm/log-td.h +819 -0
- data/ext/crlibm/log10-td.c +906 -0
- data/ext/crlibm/log10-td.h +823 -0
- data/ext/crlibm/log2-td.c +935 -0
- data/ext/crlibm/log2-td.h +821 -0
- data/ext/crlibm/maple/atan.mpl +359 -0
- data/ext/crlibm/maple/common-procedures.mpl +997 -0
- data/ext/crlibm/maple/csh.mpl +446 -0
- data/ext/crlibm/maple/double-extended.mpl +151 -0
- data/ext/crlibm/maple/exp-td.mpl +195 -0
- data/ext/crlibm/maple/log-de.mpl +243 -0
- data/ext/crlibm/maple/log-td.mpl +316 -0
- data/ext/crlibm/maple/log10-td.mpl +345 -0
- data/ext/crlibm/maple/log2-td.mpl +334 -0
- data/ext/crlibm/maple/trigo.mpl +728 -0
- data/ext/crlibm/maple/triple-double.mpl +58 -0
- data/ext/crlibm/missing +198 -0
- data/ext/crlibm/mkinstalldirs +40 -0
- data/ext/crlibm/rem_pio2_accurate.c +219 -0
- data/ext/crlibm/rem_pio2_accurate.h +53 -0
- data/ext/crlibm/scs_lib/AUTHORS +3 -0
- data/ext/crlibm/scs_lib/COPYING +504 -0
- data/ext/crlibm/scs_lib/ChangeLog +16 -0
- data/ext/crlibm/scs_lib/INSTALL +215 -0
- data/ext/crlibm/scs_lib/Makefile.am +18 -0
- data/ext/crlibm/scs_lib/Makefile.in +328 -0
- data/ext/crlibm/scs_lib/NEWS +0 -0
- data/ext/crlibm/scs_lib/README +9 -0
- data/ext/crlibm/scs_lib/TODO +4 -0
- data/ext/crlibm/scs_lib/addition_scs.c +623 -0
- data/ext/crlibm/scs_lib/config.guess +1461 -0
- data/ext/crlibm/scs_lib/config.sub +1566 -0
- data/ext/crlibm/scs_lib/configure +6226 -0
- data/ext/crlibm/scs_lib/division_scs.c +110 -0
- data/ext/crlibm/scs_lib/double2scs.c +174 -0
- data/ext/crlibm/scs_lib/install-sh +269 -0
- data/ext/crlibm/scs_lib/missing +198 -0
- data/ext/crlibm/scs_lib/mkinstalldirs +40 -0
- data/ext/crlibm/scs_lib/multiplication_scs.c +456 -0
- data/ext/crlibm/scs_lib/poly_fct.c +112 -0
- data/ext/crlibm/scs_lib/print_scs.c +73 -0
- data/ext/crlibm/scs_lib/rand_scs.c +63 -0
- data/ext/crlibm/scs_lib/scs.h +353 -0
- data/ext/crlibm/scs_lib/scs2double.c +391 -0
- data/ext/crlibm/scs_lib/scs2mpf.c +58 -0
- data/ext/crlibm/scs_lib/scs2mpfr.c +61 -0
- data/ext/crlibm/scs_lib/scs_private.c +23 -0
- data/ext/crlibm/scs_lib/scs_private.h +133 -0
- data/ext/crlibm/scs_lib/tests/tbx_timing.h +102 -0
- data/ext/crlibm/scs_lib/wrapper_scs.h +486 -0
- data/ext/crlibm/scs_lib/zero_scs.c +52 -0
- data/ext/crlibm/stamp-h.in +1 -0
- data/ext/crlibm/tests/Makefile.am +43 -0
- data/ext/crlibm/tests/Makefile.in +396 -0
- data/ext/crlibm/tests/blind_test.c +148 -0
- data/ext/crlibm/tests/generate_test_vectors.c +258 -0
- data/ext/crlibm/tests/soak_test.c +334 -0
- data/ext/crlibm/tests/test_common.c +627 -0
- data/ext/crlibm/tests/test_common.h +28 -0
- data/ext/crlibm/tests/test_perf.c +570 -0
- data/ext/crlibm/tests/test_val.c +249 -0
- data/ext/crlibm/trigo_accurate.c +500 -0
- data/ext/crlibm/trigo_accurate.h +331 -0
- data/ext/crlibm/trigo_fast.c +1219 -0
- data/ext/crlibm/trigo_fast.h +639 -0
- data/ext/crlibm/triple-double.h +878 -0
- data/ext/extconf.rb +31 -0
- data/ext/fpu.c +107 -0
- data/ext/jamis-mod.rb +591 -0
- data/lib/fpu.rb +287 -0
- data/lib/interval.rb +1170 -0
- data/lib/intervals.rb +212 -0
- data/lib/struct_float.rb +133 -0
- data/test/data_atan.txt +360 -0
- data/test/data_cos.txt +346 -0
- data/test/data_cosh.txt +3322 -0
- data/test/data_exp.txt +3322 -0
- data/test/data_log.txt +141 -0
- data/test/data_sin.txt +140 -0
- data/test/data_sinh.txt +3322 -0
- data/test/data_tan.txt +342 -0
- metadata +186 -0
@@ -0,0 +1,334 @@
|
|
1
|
+
#######################################################################
|
2
|
+
# This file is part of the crlibm library, and is distributed under
|
3
|
+
# the LGPL.
|
4
|
+
# To use:
|
5
|
+
# restart; read "log2-td.mpl";
|
6
|
+
Digits := 120:
|
7
|
+
|
8
|
+
interface(quiet=true):
|
9
|
+
|
10
|
+
read "common-procedures.mpl":
|
11
|
+
read "triple-double.mpl":
|
12
|
+
mkdir("TEMPLOG"):
|
13
|
+
|
14
|
+
|
15
|
+
# We want log2h + log2m + log2l + delta = log(2) such that
|
16
|
+
# log2h and log2m have at least 11 trailing zeros
|
17
|
+
# in order to have an exact multiplication with E, which is lower than 1024 in
|
18
|
+
# magnitude
|
19
|
+
# The resting accuracy is enough for both quick and accurate phases.
|
20
|
+
|
21
|
+
log2acc := log(2):
|
22
|
+
log2h := round(log2acc * 2**(floor(-log[2](abs(log2acc))) + (53 - 11))) / 2**(floor(-log[2](abs(log2acc))) + (53 - 11)):
|
23
|
+
log2m := round((log2acc - log2h) * 2**(floor(-log[2](abs((log2acc - log2h)))) + (53 - 11))) / 2**(floor(-log[2](abs((log2acc - log2h)))) + (53 - 11)):
|
24
|
+
log2l := log2acc - (log2h + log2m):
|
25
|
+
|
26
|
+
|
27
|
+
L := 7: # number of bits used to address the table
|
28
|
+
|
29
|
+
MAXINDEX := round(2^L * (sqrt(2)-1)):
|
30
|
+
|
31
|
+
for i from 0 to MAXINDEX-1 do
|
32
|
+
center[i] := 1 + i*2^(-L): # center[i] in [1, 2[
|
33
|
+
t := evalf(1/center[i]):
|
34
|
+
r[i] := round(t * 2**(floor(-log[2](abs(t))) + 23)) / 2**(floor(-log[2](abs(t))) + 23):
|
35
|
+
(logih[i], logim[i], logil[i]) := hi_mi_lo(evalf(-log(r[i]))):
|
36
|
+
od:
|
37
|
+
for i from MAXINDEX to 2^L do
|
38
|
+
# y has been divided by two, center[i] in [0.5, 1[
|
39
|
+
center[i]:=(1 + i*2^(-L)) / 2:
|
40
|
+
t := evalf(1/center[i]):
|
41
|
+
r[i] := round(t * 2**(floor(-log[2](abs(t))) + 23)) / 2**(floor(-log[2](abs(t))) + 23):
|
42
|
+
(logih[i], logim[i], logil[i]) := hi_mi_lo(evalf(-log(r[i]))):
|
43
|
+
od:
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
#Computation of ZMax.
|
49
|
+
for i from 0 to MAXINDEX-1 do
|
50
|
+
__x := center[i] + 2^(-L-1) :
|
51
|
+
zmax[i] := (__x*r[i]-1) :
|
52
|
+
__x := center[i] - 2^(-L-1) :
|
53
|
+
zmin[i] := (__x*r[i]-1) :
|
54
|
+
od:
|
55
|
+
for i from MAXINDEX to 2^L do
|
56
|
+
__x := center[i] + 2^(-L-2) :
|
57
|
+
zmax[i] := (__x*r[i]-1) :
|
58
|
+
__x := center[i] - 2^(-L-2) :
|
59
|
+
zmin[i] := (__x*r[i]-1) :
|
60
|
+
od:
|
61
|
+
|
62
|
+
zmaxmax:=0:
|
63
|
+
zminmin:=0:
|
64
|
+
for i from 0 to 2^L do
|
65
|
+
tabulated_value := logih[i] + logim[i] + logil[i]:
|
66
|
+
poly_approx_min := evalf(log(1+zmin[i])):
|
67
|
+
poly_approx_max := evalf(log(1+zmax[i])):
|
68
|
+
|
69
|
+
# Test if we have a case where we cancellate a lot
|
70
|
+
# i.e. the polynomial approximation value is greater than half the tabulated value
|
71
|
+
# the tabulated value is not exactly zero and we are of opposite sign
|
72
|
+
|
73
|
+
if ((abs(poly_approx_min) > 0.75*abs(tabulated_value)) and (tabulated_value <> 0.0) and (poly_approx_min * tabulated_value < 0)) then
|
74
|
+
printf("Polynomial approximation is greater in magnitude in zmin[%d] than half the tabluated value\n",i):
|
75
|
+
|
76
|
+
printf("The tabulated value is %1.50e\n",tabulated_value):
|
77
|
+
if (tabulated_value <> 0.0) then printf("i.e. the value has the exponent %d\n",floor(log2(abs(tabulated_value)))) fi:
|
78
|
+
printf("The value of polynomial in zmin[%d] is %1.50e\n",i,poly_approx_min):
|
79
|
+
if (poly_approx_min <> 0.0) then printf("i.e. the value has the exponent %d\n",floor(log2(abs(poly_approx_min)))) fi:
|
80
|
+
|
81
|
+
summe := poly_approx_min + tabulated_value:
|
82
|
+
printf("The exponent of the sum of both is %d\n",floor(log2(abs(summe)))):
|
83
|
+
|
84
|
+
|
85
|
+
fi:
|
86
|
+
|
87
|
+
if ((abs(poly_approx_max) > 0.75*abs(tabulated_value)) and (tabulated_value <> 0.0) and (poly_approx_max * tabulated_value <0)) then
|
88
|
+
printf("Polynomial approximation is greater in magnitude in zmax[%d] than half the tabluated value\n",i):
|
89
|
+
|
90
|
+
printf("The tabulated value is %1.50e\n",tabulated_value):
|
91
|
+
if (tabulated_value <> 0.0) then printf("i.e. the value has the exponent %d\n",floor(log2(abs(tabulated_value)))) fi:
|
92
|
+
printf("The value of polynomial in zmax[%d] is %1.50e\n",i,poly_approx_max):
|
93
|
+
if (poly_approx_max <> 0.0) then printf("i.e. the value has the exponent %d\n",floor(log2(abs(poly_approx_max)))) fi:
|
94
|
+
|
95
|
+
summe := poly_approx_max + tabulated_value:
|
96
|
+
printf("The exponent of the sum of both is %d\n",floor(log2(abs(summe)))):
|
97
|
+
|
98
|
+
|
99
|
+
fi:
|
100
|
+
|
101
|
+
|
102
|
+
if zmax[i] > zmaxmax then zmaxmax := zmax[i]: fi:
|
103
|
+
if zmin[i] < zminmin then zminmin := zmin[i]: fi:
|
104
|
+
od:
|
105
|
+
printf("zminmin = -2^(%2f) zmaxmax = 2^(%2f)\n", log2(-zminmin), log2(zmaxmax) ) :
|
106
|
+
|
107
|
+
PolyDegreeQuick:=7:
|
108
|
+
|
109
|
+
printf(" degree of the polynomial used in the quick phase is %d\n",PolyDegreeQuick);
|
110
|
+
|
111
|
+
DDNumberQuick:=3:
|
112
|
+
|
113
|
+
printf(" number of double doubles used for the coefficients is %d\n",DDNumberQuick);
|
114
|
+
|
115
|
+
#Keep -zmaxmax..zmaxmax to keep c1=1, which is useful in the proof
|
116
|
+
#and constrain the first two coefficients to 1 and -1/2 in order to save up a full multiplication and a rounding error
|
117
|
+
polyQuick:= poly_exact2(x*(1+x*(-0.5+x*(numapprox[minimax]((((log(1+x)/x)-1)/x+0.5)/x,
|
118
|
+
x=-zmaxmax..zmaxmax, [PolyDegreeQuick-3,0], 1 , 'deltaApprox')))), DDNumberQuick):
|
119
|
+
|
120
|
+
#Try to verify the bound for using double double arithmetic.
|
121
|
+
#Idea: compare the maximum absolute value of the polynomial in zmaxmax (the polynomial has its maxima at the limits)
|
122
|
+
#with the maximum value of the first term which is calculated in double precision only
|
123
|
+
|
124
|
+
p := unapply(polyQuick,x):
|
125
|
+
printf(" using only %d double doubles should be fine since the hi z ulp should affect the result starting from bit %f\n",
|
126
|
+
DDNumberQuick,evalf(53 + log2(p(zmaxmax)) - log2(zmaxmax^(DDNumberQuick)),5)):
|
127
|
+
|
128
|
+
|
129
|
+
epsilonApproxQuick := numapprox[infnorm]( 1-polyQuick/log(1+x), x=zminmin..zmaxmax):
|
130
|
+
printf(" approximation rel error for the quick phase is 2^(%2f)\n", log2(epsilonApproxQuick) ) :
|
131
|
+
deltaApproxQuick := numapprox[infnorm]( polyQuick-log(1+x), x=zminmin..zmaxmax):
|
132
|
+
printf(" approximation abs error for the quick phase is 2^(%2f)\n", log2(deltaApproxQuick) ) :
|
133
|
+
|
134
|
+
|
135
|
+
PolyDegreeAccurate:=14:
|
136
|
+
|
137
|
+
printf(" degree of the polynomial used in the accurate phase is %d\n",PolyDegreeAccurate);
|
138
|
+
|
139
|
+
DDNumberAccu:=7:
|
140
|
+
TDNumberAccu:=3:
|
141
|
+
|
142
|
+
printf(" number of triple doubles used for the coefficients is %d\n",TDNumberAccu);
|
143
|
+
printf(" number of double doubles used for the coefficients is %d\n",DDNumberAccu);
|
144
|
+
|
145
|
+
|
146
|
+
#Keep -zmaxmax..zmaxmax to keep c1=1, which is useful in the proof
|
147
|
+
polyAccurate:= poly_exact32(x*(1+x*(-0.5+x*(numapprox[minimax]((((log(1+x)/x)-1)/x+0.5)/x,
|
148
|
+
x=-zmaxmax..zmaxmax, [PolyDegreeAccurate-3,0], 1 , 'deltaApprox')))),
|
149
|
+
TDNumberAccu, DDNumberAccu):
|
150
|
+
|
151
|
+
#Try to verify the bound for using double double arithmetic.
|
152
|
+
#Idea: compare the maximum absolute value of the polynomial in zmaxmax (the polynomial has its maxima at the limits)
|
153
|
+
#with the maximum value of the first term which is calculated in double precision only
|
154
|
+
|
155
|
+
pp := unapply(polyAccurate,x):
|
156
|
+
printf(" using only %d triple doubles should be fine since the mi z ulp should affect the result starting from bit %f\n",
|
157
|
+
TDNumberAccu,evalf(106 + log2(p(zmaxmax)) - log2(zmaxmax^(TDNumberAccu)),5)):
|
158
|
+
printf(" using only %d double doubles should be fine since the hi z ulp should affect the result starting from bit %f\n",
|
159
|
+
DDNumberAccu,evalf(53 + log2(p(zmaxmax)) - log2(zmaxmax^(TDNumberAccu + DDNumberAccu)),5)):
|
160
|
+
|
161
|
+
|
162
|
+
epsilonApproxAccurate := numapprox[infnorm]( 1-polyAccurate/log(1+x), x=zminmin..zmaxmax):
|
163
|
+
printf(" approximation rel error for the accurate phase is 2^(%2f)\n", log2(epsilonApproxAccurate) ) :
|
164
|
+
deltaApproxAccurate := numapprox[infnorm]( polyAccurate-log(1+x), x=zminmin..zmaxmax):
|
165
|
+
printf(" approximation abs error for the quick phase is 2^(%2f)\n", log2(deltaApproxAccurate) ) :
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
#Compute now the inverse of ln(2) for the final addition of ln(x) with this constant for obtaining log2(x)
|
170
|
+
#Compute also the relative error of the constant stored as a double double.
|
171
|
+
Log2inv := evalf(1 / log(2)):
|
172
|
+
|
173
|
+
(log2invh, log2invl) := hi_lo(Log2inv):
|
174
|
+
|
175
|
+
Log2invhl := log2invh + log2invl:
|
176
|
+
|
177
|
+
epsilonLog2invhl := evalf(abs((Log2invhl - Log2inv) / Log2inv)):
|
178
|
+
|
179
|
+
printf(" Log2inv = 1 / ln(2) stored as a double-double is exact with a relative error of 2^(%2f)\n",
|
180
|
+
evalf(log[2](epsilonLog2invhl))):
|
181
|
+
|
182
|
+
|
183
|
+
#-------------------------------------------------------------------
|
184
|
+
# Output
|
185
|
+
|
186
|
+
|
187
|
+
filename:="TEMPLOG/log2-td.h":
|
188
|
+
fd:=fopen(filename, WRITE, TEXT):
|
189
|
+
|
190
|
+
fprintf(fd, "#include \"crlibm.h\"\n#include \"crlibm_private.h\"\n"):
|
191
|
+
|
192
|
+
fprintf(fd, "\n/*File generated by maple/log2-td.mpl*/\n"):
|
193
|
+
|
194
|
+
fprintf(fd, "\n\#define L %d\n\n",L):
|
195
|
+
fprintf(fd, "\#define MAXINDEX %d\n\n", MAXINDEX):
|
196
|
+
fprintf(fd, "\#define INDEXMASK %d\n", 2^L-1):
|
197
|
+
fprintf(fd, "\#define two52 %1.50e\n", 2^(52)):
|
198
|
+
fprintf(fd, "\#define log2h %1.50e\n", log2h):
|
199
|
+
fprintf(fd, "\#define log2m %1.50e\n", log2m):
|
200
|
+
fprintf(fd, "\#define log2l %1.50e\n", log2l):
|
201
|
+
fprintf(fd, "\#define log2invh %1.50e\n",log2invh):
|
202
|
+
fprintf(fd, "\#define log2invl %1.50e\n",log2invl):
|
203
|
+
|
204
|
+
epsilon_quick_1 := 2^(-61): # The Gappa proof will show this bound
|
205
|
+
epsilon_quick_2 := 2^(-61): # The Gappa proof will show this bound
|
206
|
+
fprintf(fd, "\#define ROUNDCST1 %1.50e\n", compute_rn_constant(epsilon_quick_1)):
|
207
|
+
fprintf(fd, "\#define ROUNDCST2 %1.50e\n", compute_rn_constant(epsilon_quick_2)):
|
208
|
+
fprintf(fd, "\#define RDROUNDCST1 %1.50e\n", epsilon_quick_1):
|
209
|
+
fprintf(fd, "\#define RDROUNDCST2 %1.50e\n", epsilon_quick_2):
|
210
|
+
|
211
|
+
|
212
|
+
fprintf(fd, "\n\n"):
|
213
|
+
|
214
|
+
|
215
|
+
# Print the defines for the define statements
|
216
|
+
|
217
|
+
for i from 3 to PolyDegreeQuick do
|
218
|
+
fprintf(fd, "\#define c%d %1.50e\n",i,coeff(polyQuick,x,i)):
|
219
|
+
od:
|
220
|
+
|
221
|
+
fprintf(fd, "\n\n"):
|
222
|
+
|
223
|
+
for i from 3 to (DDNumberAccu + TDNumberAccu -1) do
|
224
|
+
(hi,lo) := hi_lo(coeff(polyAccurate,x,i)):
|
225
|
+
fprintf(fd, "\#define accPolyC%dh %1.50e\n",i,hi):
|
226
|
+
fprintf(fd, "\#define accPolyC%dl %1.50e\n",i,lo):
|
227
|
+
od:
|
228
|
+
|
229
|
+
for i from (DDNumberAccu + TDNumberAccu) to PolyDegreeAccurate do
|
230
|
+
fprintf(fd, "\#define accPolyC%d %1.50e\n",i,coeff(polyAccurate,x,i)):
|
231
|
+
od:
|
232
|
+
|
233
|
+
fprintf(fd, "\n\n"):
|
234
|
+
|
235
|
+
# Print the table
|
236
|
+
fprintf(fd, "typedef struct rri_tag {float ri; double logih; double logim; double logil;} rri; \n"):
|
237
|
+
fprintf(fd, "static const rri argredtable[%d] = {\n", 2^L):
|
238
|
+
for i from 0 to 2^L-1 do
|
239
|
+
fprintf(fd, " { \n"):
|
240
|
+
fprintf(fd, " %1.50e, /* r[%d] */ \n", r[i], i):
|
241
|
+
fprintf(fd, " %1.50e, /* logih[%d] */ \n", logih[i], i):
|
242
|
+
fprintf(fd, " %1.50e, /* logim[%d] */ \n", logim[i], i):
|
243
|
+
fprintf(fd, " %1.50e, /* logil[%d] */ \n", logil[i], i):
|
244
|
+
fprintf(fd, " } "):
|
245
|
+
if(i<2^L-1) then fprintf(fd, ", \n"): fi
|
246
|
+
od:
|
247
|
+
fprintf(fd, "}; \n \n"):
|
248
|
+
|
249
|
+
fclose(fd):
|
250
|
+
|
251
|
+
for j from 0 to 2^L-1 do
|
252
|
+
filename:=cat("TEMPLOG/log2-td_",j,".sed"):
|
253
|
+
fd:=fopen(filename, WRITE, TEXT):
|
254
|
+
fprintf(fd, " s/_log2h/%1.50e/g\n", log2h):
|
255
|
+
fprintf(fd, " s/_log2m/%1.50e/g\n", log2m):
|
256
|
+
fprintf(fd, " s/_log2l/%1.50e/g\n", log2l):
|
257
|
+
fprintf(fd, " s/_logih/%1.50e/g\n", logih[j]):
|
258
|
+
fprintf(fd, " s/_logim/%1.50e/g\n", logim[j]):
|
259
|
+
fprintf(fd, " s/_logil/%1.50e/g\n", logil[j]):
|
260
|
+
fprintf(fd, " s/_zmin/%1.50e/g\n", zmin[j]):
|
261
|
+
fprintf(fd, " s/_zmax/%1.50e/g\n", zmax[j]):
|
262
|
+
for i from 3 to PolyDegreeQuick do
|
263
|
+
fprintf(fd, " s/_c%d/%1.50e/g\n", i, coeff(polyQuick,x,i)):
|
264
|
+
od:
|
265
|
+
fprintf(fd, " s/_epsilonApproxQuick/%1.50e/g\n", epsilonApproxQuick):
|
266
|
+
fprintf(fd, " s/_epsilonLog2invhl/%1.50e/g\n", epsilonLog2invhl):
|
267
|
+
fclose(fd):
|
268
|
+
od:
|
269
|
+
|
270
|
+
for j from 0 to 2^L-1 do
|
271
|
+
filename:=cat("TEMPLOG/log2-td-accurate_",j,".sed"):
|
272
|
+
fd:=fopen(filename, WRITE, TEXT):
|
273
|
+
fprintf(fd, " s/_log2h/%1.50e/g\n", log2h):
|
274
|
+
fprintf(fd, " s/_log2m/%1.50e/g\n", log2m):
|
275
|
+
fprintf(fd, " s/_log2l/%1.50e/g\n", log2l):
|
276
|
+
fprintf(fd, " s/_logih/%1.50e/g\n", logih[j]):
|
277
|
+
fprintf(fd, " s/_logim/%1.50e/g\n", logim[j]):
|
278
|
+
fprintf(fd, " s/_logil/%1.50e/g\n", logil[j]):
|
279
|
+
fprintf(fd, " s/_zmin/%1.50e/g\n", zmin[j]):
|
280
|
+
fprintf(fd, " s/_zmax/%1.50e/g\n", zmax[j]):
|
281
|
+
for i from 3 to (DDNumberAccu + TDNumberAccu -1) do
|
282
|
+
(hi,lo) := hi_lo(coeff(polyAccurate,x,i)):
|
283
|
+
fprintf(fd, " s/_accPolyC%dh/%1.50e/g\n", i, hi):
|
284
|
+
fprintf(fd, " s/_accPolyC%dl/%1.50e/g\n", i, lo):
|
285
|
+
od:
|
286
|
+
for i from (DDNumberAccu + TDNumberAccu) to PolyDegreeAccurate do
|
287
|
+
fprintf(fd, " s/_accPolyC%d/%1.50e/g\n", i, coeff(polyAccurate,x,i)):
|
288
|
+
od:
|
289
|
+
fprintf(fd, " s/_epsilonApproxAccurate/%1.50e/g\n", epsilonApproxAccurate):
|
290
|
+
fprintf(fd, " s/_epsilonLog2invhl/%1.50e/g\n", epsilonLog2invhl):
|
291
|
+
fclose(fd):
|
292
|
+
od:
|
293
|
+
|
294
|
+
# A shell script to use them
|
295
|
+
filename:="run-log2-td-proof.sh":
|
296
|
+
fd:=fopen(filename, WRITE, TEXT):
|
297
|
+
fprintf(fd, "#!/bin/sh\n"):
|
298
|
+
fprintf(fd, "# You probably need to edit the path to the gappa executable\n"):
|
299
|
+
fprintf(fd, "GAPPA=~/ble/gappa-0.4.5/src/gappa\n"):
|
300
|
+
fprintf(fd, "# Test all the possible table value for E=1\n"):
|
301
|
+
fprintf(fd, "for num in `seq 0 %d`; do\n", 2^L-1):
|
302
|
+
fprintf(fd, " echo $num, E=1:\n"):
|
303
|
+
fprintf(fd, " sed -f ./TEMPLOG/log2-td_$num.sed log2-td.gappa | $GAPPA > /dev/null\n"):
|
304
|
+
fprintf(fd, " echo\n"):
|
305
|
+
fprintf(fd, "done\n"):
|
306
|
+
fprintf(fd, "# For the case E=0 we first handle the cases 0 and %d using log2-td-E0-logir0.gappa\n", 2^L):
|
307
|
+
fprintf(fd, "echo 0 and %d, E=0:\n", 2^L):
|
308
|
+
fprintf(fd, "sed -f log2-td_0.sed log2-td-E0-logir0.gappa | $GAPPA > /dev/null\n"):
|
309
|
+
fprintf(fd, "# then the other cases where logirh <> 0\n"):
|
310
|
+
fprintf(fd, "for num in `seq 1 %d`; do\n", 2^L-1):
|
311
|
+
fprintf(fd, " echo $num, E=0:\n"):
|
312
|
+
fprintf(fd, " sed -f ./TEMPLOG/log2-td_$num.sed log2-td-E0.gappa | $GAPPA > /dev/null\n"):
|
313
|
+
fprintf(fd, " echo\n"):
|
314
|
+
fprintf(fd, "done\n"):
|
315
|
+
fprintf(fd, "# Accurate phase: Test all the possible table value for E=1\n"):
|
316
|
+
fprintf(fd, "for num in `seq 0 %d`; do\n", 2^L-1):
|
317
|
+
fprintf(fd, " echo Accurate phase: $num, E=1:\n"):
|
318
|
+
fprintf(fd, " sed -f ./TEMPLOG/log2-td-accurate_$num.sed log2-td-accurate.gappa | $GAPPA > /dev/null\n"):
|
319
|
+
fprintf(fd, " echo\n"):
|
320
|
+
fprintf(fd, "done\n"):
|
321
|
+
fprintf(fd, "# Accurate phase: For the case E=0 we first handle the cases 0 and %d using log2-td-accurate-E0-logir0.gappa\n", 2^L):
|
322
|
+
fprintf(fd, "echo 0 and %d, E=0:\n", 2^L):
|
323
|
+
fprintf(fd, "sed -f ./TEMPLOG/log2-td-accurate_0.sed log2-td-accurate-E0-logir0.gappa | $GAPPA > /dev/null\n"):
|
324
|
+
fprintf(fd, "# Accurate phase: then the other cases where logirh <> 0\n"):
|
325
|
+
fprintf(fd, "for num in `seq 1 %d`; do\n", 2^L-1):
|
326
|
+
fprintf(fd, " echo $num, E=0:\n"):
|
327
|
+
fprintf(fd, " sed -f ./TEMPLOG/log2-td-accurate_$num.sed log2-td-accurate-E0.gappa | $GAPPA > /dev/null\n"):
|
328
|
+
fprintf(fd, " echo\n"):
|
329
|
+
fprintf(fd, "done\n"):
|
330
|
+
fclose(fd):
|
331
|
+
|
332
|
+
printf("----DONE---\n") :
|
333
|
+
|
334
|
+
|