intervals 0.3.56

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/VERSION.txt +1 -0
  2. data/ext/crlibm/AUTHORS +2 -0
  3. data/ext/crlibm/COPYING +504 -0
  4. data/ext/crlibm/ChangeLog +80 -0
  5. data/ext/crlibm/INSTALL +182 -0
  6. data/ext/crlibm/Makefile.am +84 -0
  7. data/ext/crlibm/Makefile.in +530 -0
  8. data/ext/crlibm/NEWS +0 -0
  9. data/ext/crlibm/README +31 -0
  10. data/ext/crlibm/TODO +47 -0
  11. data/ext/crlibm/VERSION +1 -0
  12. data/ext/crlibm/aclocal.m4 +989 -0
  13. data/ext/crlibm/atan-itanium.c +846 -0
  14. data/ext/crlibm/atan-pentium.c +261 -0
  15. data/ext/crlibm/atan_accurate.c +244 -0
  16. data/ext/crlibm/atan_accurate.h +191 -0
  17. data/ext/crlibm/atan_fast.c +324 -0
  18. data/ext/crlibm/atan_fast.h +678 -0
  19. data/ext/crlibm/config.guess +1461 -0
  20. data/ext/crlibm/config.sub +1566 -0
  21. data/ext/crlibm/configure +7517 -0
  22. data/ext/crlibm/configure.ac +364 -0
  23. data/ext/crlibm/crlibm.h +125 -0
  24. data/ext/crlibm/crlibm_config.h +149 -0
  25. data/ext/crlibm/crlibm_config.h.in +148 -0
  26. data/ext/crlibm/crlibm_private.c +293 -0
  27. data/ext/crlibm/crlibm_private.h +658 -0
  28. data/ext/crlibm/csh_fast.c +631 -0
  29. data/ext/crlibm/csh_fast.h +771 -0
  30. data/ext/crlibm/double-extended.h +496 -0
  31. data/ext/crlibm/exp-td.c +962 -0
  32. data/ext/crlibm/exp-td.h +685 -0
  33. data/ext/crlibm/exp_accurate.c +197 -0
  34. data/ext/crlibm/exp_accurate.h +85 -0
  35. data/ext/crlibm/gappa/log-de-E0-logir0.gappa +106 -0
  36. data/ext/crlibm/gappa/log-de-E0.gappa +79 -0
  37. data/ext/crlibm/gappa/log-de.gappa +81 -0
  38. data/ext/crlibm/gappa/log-td-E0-logir0.gappa +126 -0
  39. data/ext/crlibm/gappa/log-td-E0.gappa +143 -0
  40. data/ext/crlibm/gappa/log-td-accurate-E0-logir0.gappa +230 -0
  41. data/ext/crlibm/gappa/log-td-accurate-E0.gappa +213 -0
  42. data/ext/crlibm/gappa/log-td-accurate.gappa +217 -0
  43. data/ext/crlibm/gappa/log-td.gappa +156 -0
  44. data/ext/crlibm/gappa/trigoSinCosCase3.gappa +204 -0
  45. data/ext/crlibm/gappa/trigoTanCase2.gappa +73 -0
  46. data/ext/crlibm/install-sh +269 -0
  47. data/ext/crlibm/log-de.c +431 -0
  48. data/ext/crlibm/log-de.h +732 -0
  49. data/ext/crlibm/log-td.c +852 -0
  50. data/ext/crlibm/log-td.h +819 -0
  51. data/ext/crlibm/log10-td.c +906 -0
  52. data/ext/crlibm/log10-td.h +823 -0
  53. data/ext/crlibm/log2-td.c +935 -0
  54. data/ext/crlibm/log2-td.h +821 -0
  55. data/ext/crlibm/maple/atan.mpl +359 -0
  56. data/ext/crlibm/maple/common-procedures.mpl +997 -0
  57. data/ext/crlibm/maple/csh.mpl +446 -0
  58. data/ext/crlibm/maple/double-extended.mpl +151 -0
  59. data/ext/crlibm/maple/exp-td.mpl +195 -0
  60. data/ext/crlibm/maple/log-de.mpl +243 -0
  61. data/ext/crlibm/maple/log-td.mpl +316 -0
  62. data/ext/crlibm/maple/log10-td.mpl +345 -0
  63. data/ext/crlibm/maple/log2-td.mpl +334 -0
  64. data/ext/crlibm/maple/trigo.mpl +728 -0
  65. data/ext/crlibm/maple/triple-double.mpl +58 -0
  66. data/ext/crlibm/missing +198 -0
  67. data/ext/crlibm/mkinstalldirs +40 -0
  68. data/ext/crlibm/rem_pio2_accurate.c +219 -0
  69. data/ext/crlibm/rem_pio2_accurate.h +53 -0
  70. data/ext/crlibm/scs_lib/AUTHORS +3 -0
  71. data/ext/crlibm/scs_lib/COPYING +504 -0
  72. data/ext/crlibm/scs_lib/ChangeLog +16 -0
  73. data/ext/crlibm/scs_lib/INSTALL +215 -0
  74. data/ext/crlibm/scs_lib/Makefile.am +18 -0
  75. data/ext/crlibm/scs_lib/Makefile.in +328 -0
  76. data/ext/crlibm/scs_lib/NEWS +0 -0
  77. data/ext/crlibm/scs_lib/README +9 -0
  78. data/ext/crlibm/scs_lib/TODO +4 -0
  79. data/ext/crlibm/scs_lib/addition_scs.c +623 -0
  80. data/ext/crlibm/scs_lib/config.guess +1461 -0
  81. data/ext/crlibm/scs_lib/config.sub +1566 -0
  82. data/ext/crlibm/scs_lib/configure +6226 -0
  83. data/ext/crlibm/scs_lib/division_scs.c +110 -0
  84. data/ext/crlibm/scs_lib/double2scs.c +174 -0
  85. data/ext/crlibm/scs_lib/install-sh +269 -0
  86. data/ext/crlibm/scs_lib/missing +198 -0
  87. data/ext/crlibm/scs_lib/mkinstalldirs +40 -0
  88. data/ext/crlibm/scs_lib/multiplication_scs.c +456 -0
  89. data/ext/crlibm/scs_lib/poly_fct.c +112 -0
  90. data/ext/crlibm/scs_lib/print_scs.c +73 -0
  91. data/ext/crlibm/scs_lib/rand_scs.c +63 -0
  92. data/ext/crlibm/scs_lib/scs.h +353 -0
  93. data/ext/crlibm/scs_lib/scs2double.c +391 -0
  94. data/ext/crlibm/scs_lib/scs2mpf.c +58 -0
  95. data/ext/crlibm/scs_lib/scs2mpfr.c +61 -0
  96. data/ext/crlibm/scs_lib/scs_private.c +23 -0
  97. data/ext/crlibm/scs_lib/scs_private.h +133 -0
  98. data/ext/crlibm/scs_lib/tests/tbx_timing.h +102 -0
  99. data/ext/crlibm/scs_lib/wrapper_scs.h +486 -0
  100. data/ext/crlibm/scs_lib/zero_scs.c +52 -0
  101. data/ext/crlibm/stamp-h.in +1 -0
  102. data/ext/crlibm/tests/Makefile.am +43 -0
  103. data/ext/crlibm/tests/Makefile.in +396 -0
  104. data/ext/crlibm/tests/blind_test.c +148 -0
  105. data/ext/crlibm/tests/generate_test_vectors.c +258 -0
  106. data/ext/crlibm/tests/soak_test.c +334 -0
  107. data/ext/crlibm/tests/test_common.c +627 -0
  108. data/ext/crlibm/tests/test_common.h +28 -0
  109. data/ext/crlibm/tests/test_perf.c +570 -0
  110. data/ext/crlibm/tests/test_val.c +249 -0
  111. data/ext/crlibm/trigo_accurate.c +500 -0
  112. data/ext/crlibm/trigo_accurate.h +331 -0
  113. data/ext/crlibm/trigo_fast.c +1219 -0
  114. data/ext/crlibm/trigo_fast.h +639 -0
  115. data/ext/crlibm/triple-double.h +878 -0
  116. data/ext/extconf.rb +31 -0
  117. data/ext/fpu.c +107 -0
  118. data/ext/jamis-mod.rb +591 -0
  119. data/lib/fpu.rb +287 -0
  120. data/lib/interval.rb +1170 -0
  121. data/lib/intervals.rb +212 -0
  122. data/lib/struct_float.rb +133 -0
  123. data/test/data_atan.txt +360 -0
  124. data/test/data_cos.txt +346 -0
  125. data/test/data_cosh.txt +3322 -0
  126. data/test/data_exp.txt +3322 -0
  127. data/test/data_log.txt +141 -0
  128. data/test/data_sin.txt +140 -0
  129. data/test/data_sinh.txt +3322 -0
  130. data/test/data_tan.txt +342 -0
  131. metadata +186 -0
@@ -0,0 +1,217 @@
1
+
2
+ log2h = <float64ne> (_log2h);
3
+ log2m = <float64ne> (_log2m);
4
+ log2l = <float64ne> (_log2l);
5
+
6
+ Log2hml = log2h + log2m + log2l; #MAPLE
7
+
8
+ logih = <float64ne> (_logih);
9
+ logim = <float64ne> (_logim);
10
+ logil = <float64ne> (_logil);
11
+
12
+ Logihml = logih + logim + logil; #MAPLE
13
+
14
+
15
+ accPolyC14 = <float64ne> (_accPolyC14);
16
+ accPolyC13 = <float64ne> (_accPolyC13);
17
+ accPolyC12 = <float64ne> (_accPolyC12);
18
+ accPolyC11 = <float64ne> (_accPolyC11);
19
+ accPolyC10 = <float64ne> (_accPolyC10);
20
+
21
+ accPolyC9h = <float64ne> (_accPolyC9h);
22
+ accPolyC9l = <float64ne> (_accPolyC9l);
23
+ AccPolyC9hl = accPolyC9h + accPolyC9l; #MAPLE
24
+ accPolyC8h = <float64ne> (_accPolyC8h);
25
+ accPolyC8l = <float64ne> (_accPolyC8l);
26
+ AccPolyC8hl = accPolyC8h + accPolyC8l; #MAPLE
27
+ accPolyC7h = <float64ne> (_accPolyC7h);
28
+ accPolyC7l = <float64ne> (_accPolyC7l);
29
+ AccPolyC7hl = accPolyC7h + accPolyC7l; #MAPLE
30
+ accPolyC6h = <float64ne> (_accPolyC6h);
31
+ accPolyC6l = <float64ne> (_accPolyC6l);
32
+ AccPolyC6hl = accPolyC6h + accPolyC6l; #MAPLE
33
+ accPolyC5h = <float64ne> (_accPolyC5h);
34
+ accPolyC5l = <float64ne> (_accPolyC5l);
35
+ AccPolyC5hl = accPolyC5h + accPolyC5l; #MAPLE
36
+ accPolyC4h = <float64ne> (_accPolyC4h);
37
+ accPolyC4l = <float64ne> (_accPolyC4l);
38
+ AccPolyC4hl = accPolyC4h + accPolyC4l; #MAPLE
39
+ accPolyC3h = <float64ne> (_accPolyC3h);
40
+ accPolyC3l = <float64ne> (_accPolyC3l);
41
+ AccPolyC3hl = accPolyC3h + accPolyC3l; #MAPLE
42
+
43
+ E = 1; #MAPLE
44
+
45
+ zh = <float64ne> (Z);
46
+ zl = Z - zh; #MAPLE
47
+
48
+ highPoly <float64ne> = accPolyC10 + zh * (accPolyC11 + zh * (accPolyC12 + zh * (accPolyC13 + zh * accPolyC14)));
49
+
50
+ T1hl = zh * highPoly; #MAPLE
51
+
52
+ T2 = AccPolyC9hl + T1hl; #MAPLE
53
+ T3 = Z * T2hl; #MAPLE
54
+ T4 = AccPolyC8hl + T3hl; #MAPLE
55
+ T5 = Z * T4hl; #MAPLE
56
+ T6 = AccPolyC7hl + T5hl; #MAPLE
57
+ T7 = Z * T6hl; #MAPLE
58
+ T8 = AccPolyC6hl + T7hl; #MAPLE
59
+ T9 = Z * T8hl; #MAPLE
60
+ T10 = AccPolyC5hl + T9hl; #MAPLE
61
+ T11 = Z * T10hl; #MAPLE
62
+ T12 = AccPolyC4hl + T11hl; #MAPLE
63
+ T13 = Z * T12hl; #MAPLE
64
+ T14 = AccPolyC3hl + T13hl; #MAPLE
65
+
66
+
67
+ ZSquare = Z * Z; #MAPLE
68
+ ZCube = Z * ZSquarehml; #MAPLE
69
+ HigherPolyMultZ = T14hl * ZCubehml; #MAPLE
70
+ ZSquareHalfhml = -0.5 * ZSquarehml; #MAPLE
71
+ PolyWithSquare = ZSquareHalfhml + HigherPolyMultZhml; #MAPLE
72
+ Poly = Z + PolyWithSquarehml; #MAPLE
73
+ Logy = Logihml + Polyhml; #MAPLE
74
+ Log2edhml = E * Log2hml; #MAPLE
75
+ Logover = Log2edhml + Logyhml; #MAPLE
76
+
77
+
78
+ #Mathematical definition of the logarithm
79
+
80
+ MHighPoly = accPolyC10 + Z * (accPolyC11 + Z * (accPolyC12 + Z * (accPolyC13 + Z * accPolyC14))); #MAPLE
81
+ MT1 = Z * MHighPoly; #MAPLE
82
+ MT2 = AccPolyC9hl + MT1; #MAPLE
83
+ MT3 = Z * MT2; #MAPLE
84
+ MT4 = AccPolyC8hl + MT3; #MAPLE
85
+ MT5 = Z * MT4; #MAPLE
86
+ MT6 = AccPolyC7hl + MT5; #MAPLE
87
+ MT7 = Z * MT6; #MAPLE
88
+ MT8 = AccPolyC6hl + MT7; #MAPLE
89
+ MT9 = Z * MT8; #MAPLE
90
+ MT10 = AccPolyC5hl + MT9; #MAPLE
91
+ MT11 = Z * MT10; #MAPLE
92
+ MT12 = AccPolyC4hl + MT11; #MAPLE
93
+ MT13 = Z * MT12; #MAPLE
94
+ MT14 = AccPolyC3hl + MT13; #MAPLE
95
+ MZSquare = Z * Z; #MAPLE
96
+ MZCube = Z * MZSquare; #MAPLE
97
+ MHigherPolyMultZ = MT14 * MZCube; #MAPLE
98
+ MZSquareHalf = -0.5 * MZSquare; #MAPLE
99
+ MPolyWithSquare = MZSquareHalf + MHigherPolyMultZ; #MAPLE
100
+ MPoly = Z + MPolyWithSquare; #MAPLE
101
+ MLogy = MLogi + MLog1pZ; #MAPLE
102
+ MLog2E = E * MLog2; #MAPLE
103
+ MLog = MLog2E + MLogy; #MAPLE
104
+
105
+
106
+ #Useful additional definitions
107
+
108
+ delta1 = highPoly - MHighPoly; #MAPLE
109
+ delta2 = T1hl - MT1; #MAPLE
110
+ delta3 = T2hl - MT2; #MAPLE
111
+ delta4 = T3hl - MT3; #MAPLE
112
+ delta5 = T4hl - MT4; #MAPLE
113
+ delta6 = T5hl - MT5; #MAPLE
114
+ delta7 = T6hl - MT6; #MAPLE
115
+ delta8 = T7hl - MT7; #MAPLE
116
+ delta9 = T8hl - MT8; #MAPLE
117
+ delta10 = T9hl - MT9; #MAPLE
118
+ delta11 = T10hl - MT10; #MAPLE
119
+ delta12 = T11hl - MT11; #MAPLE
120
+ delta13 = T12hl - MT12; #MAPLE
121
+ delta14 = T13hl - MT13; #MAPLE
122
+ delta15 = T14hl - MT14; #MAPLE
123
+ delta16 = ZSquarehml - MZSquare; #MAPLE
124
+ delta17 = ZCubehml - MZCube; #MAPLE
125
+ delta18 = HigherPolyMultZhml - MHigherPolyMultZ; #MAPLE
126
+ delta19 = ZSquareHalfhml - MZSquareHalf; #MAPLE
127
+ delta20 = PolyWithSquarehml - MPolyWithSquare; #MAPLE
128
+ delta21 = Polyhml - MPoly; #MAPLE
129
+ delta22 = Logyhml - MLogy; #MAPLE
130
+ delta23 = Log2edhml - MLog2E; #MAPLE
131
+ delta24 = Loghml - MLog; #MAPLE
132
+ delta25 = Logihml - MLogi; #MAPLE
133
+ delta26 = Polyhml - MLog1pZ; #MAPLE
134
+
135
+
136
+ #End additional definitions
137
+
138
+ {
139
+ (T2hl - T2) / T2 in [-1b-103,1b-103]
140
+ /\ (T3hl - T3) / T3 in [-1b-102,1b-102]
141
+ /\ (T4hl - T4) / T4 in [-1b-103,1b-103]
142
+ /\ (T5hl - T5) / T5 in [-1b-102,1b-102]
143
+ /\ (T6hl - T6) / T6 in [-1b-103,1b-103]
144
+ /\ (T7hl - T7) / T7 in [-1b-102,1b-102]
145
+ /\ (T8hl - T8) / T8 in [-1b-103,1b-103]
146
+ /\ (T9hl - T9) / T9 in [-1b-102,1b-102]
147
+ /\ (T10hl - T10) / T10 in [-1b-103,1b-103]
148
+ /\ (T11hl - T11) / T11 in [-1b-102,1b-102]
149
+ /\ (T12hl - T12) / T12 in [-1b-103,1b-103]
150
+ /\ (T13hl - T13) / T13 in [-1b-102,1b-102]
151
+ /\ (T14hl - T14) / T14 in [-1b-103,1b-103]
152
+ /\ (ZSquarehml - ZSquare) / ZSquare in [-1b-149,1b-149]
153
+ /\ (ZCubehml - ZCube) / ZCube in [-1b-144,1b-144]
154
+ /\ (HigherPolyMultZhml - HigherPolyMultZ) / HigherPolyMultZ in [-1b-141,1b-141]
155
+ /\ (PolyWithSquarehml - PolyWithSquare) / PolyWithSquare in [-1b-137,1b-137]
156
+ /\ (Polyhml - Poly) / Poly in [-1b-134,1b-134]
157
+ /\ (Logyhml - Logy) / Logy in [-1b-128,1b-128]
158
+ /\ (Loghml - Logover) / Logover in [-1b-123,1b-123]
159
+ /\ (Log2hml - MLog2) / MLog2 in [-1b-126,1b-126]
160
+ /\ (Logihml - MLogi) / MLogi in [-1b-159,1b-159]
161
+ /\ (MPoly - MLog1pZ) / MLog1pZ in [-_epsilonApproxAccurate,_epsilonApproxAccurate]
162
+ /\ Z in [_zmin,_zmax]
163
+ /\ ((logh + logm + logl) - Loghml) / Loghml in [-1b-159,1b-159]
164
+ ->
165
+ ((logh + logm + logl) - MLog) / MLog in [-5735b-132,5735b-132]
166
+ }
167
+
168
+ MLog1pZ -> MPoly * (1 / (((MPoly - MLog1pZ) / MLog1pZ) + 1));
169
+ MLog2 -> Log2hml * (1 / (((Log2hml - MLog2) / MLog2) + 1));
170
+ MLogi -> Logihml * (1 / (((Logihml - MLogi) / MLogi) + 1));
171
+
172
+ T2hl -> (T2 * ((T2hl - T2) / T2)) + T2;
173
+ T3hl -> (T3 * ((T3hl - T3) / T3)) + T3;
174
+ T4hl -> (T4 * ((T4hl - T4) / T4)) + T4;
175
+ T5hl -> (T5 * ((T5hl - T5) / T5)) + T5;
176
+ T6hl -> (T6 * ((T6hl - T6) / T6)) + T6;
177
+ T7hl -> (T7 * ((T7hl - T7) / T7)) + T7;
178
+ T8hl -> (T8 * ((T8hl - T8) / T8)) + T8;
179
+ T9hl -> (T9 * ((T9hl - T9) / T9)) + T9;
180
+ T10hl -> (T10 * ((T10hl - T10) / T10)) + T10;
181
+ T11hl -> (T11 * ((T11hl - T11) / T11)) + T11;
182
+ T12hl -> (T12 * ((T12hl - T12) / T12)) + T12;
183
+ T13hl -> (T13 * ((T13hl - T13) / T13)) + T13;
184
+ T14hl -> (T14 * ((T14hl - T14) / T14)) + T14;
185
+
186
+ ZSquarehml -> (ZSquare * ((ZSquarehml - ZSquare) / ZSquare)) + ZSquare;
187
+ ZCubehml -> (ZCube * ((ZCubehml - ZCube) / ZCube)) + ZCube;
188
+ HigherPolyMultZhml -> (HigherPolyMultZ * ((HigherPolyMultZhml - HigherPolyMultZ) / HigherPolyMultZ)) + HigherPolyMultZ;
189
+ PolyWithSquarehml -> (PolyWithSquare * ((PolyWithSquarehml - PolyWithSquare) / PolyWithSquare)) + PolyWithSquare;
190
+ Polyhml -> (Poly * ((Polyhml - Poly) / Poly)) + Poly;
191
+ Logyhml -> (Logy * ((Logyhml - Logy) / Logy)) + Logy;
192
+
193
+
194
+ delta3 -> delta2 + (T2 * ((T2hl - T2) / T2));
195
+ delta4 -> Z * delta3 + T3 * ((T3hl - T3) / T3);
196
+ delta5 -> delta4 + (T4 * ((T4hl - T4) / T4));
197
+ delta6 -> Z * delta5 + T5 * ((T5hl - T5) / T5);
198
+ delta7 -> delta6 + (T6 * ((T6hl - T6) / T6));
199
+ delta8 -> Z * delta7 + T7 * ((T7hl - T7) / T7);
200
+ delta9 -> delta8 + (T8 * ((T8hl - T8) / T8));
201
+ delta10 -> Z * delta9 + T9 * ((T9hl - T9) / T9);
202
+ delta11 -> delta10 + (T10 * ((T10hl - T10) / T10));
203
+ delta12 -> Z * delta11 + T11 * ((T11hl - T11) / T11);
204
+ delta13 -> delta12 + (T12 * ((T12hl - T12) / T12));
205
+ delta14 -> Z * delta13 + T13 * ((T13hl - T13) / T13);
206
+ delta15 -> delta14 + (T14 * ((T14hl - T14) / T14));
207
+ delta16 -> Z*Z*((ZSquarehml - ZSquare) / ZSquare);
208
+ delta17 -> Z * delta16 + ZCube * ((ZCubehml - ZCube) / ZCube);
209
+ delta18 -> delta15 * delta17 + delta15 * MZCube + delta17 * MT14 +
210
+ HigherPolyMultZ * ((HigherPolyMultZhml - HigherPolyMultZ) / HigherPolyMultZ);
211
+ delta20 -> delta19 + delta18 + PolyWithSquare * ((PolyWithSquarehml - PolyWithSquare) / PolyWithSquare);
212
+ delta21 -> delta20 + Poly * ((Polyhml - Poly) / Poly);
213
+ delta22 -> delta25 + delta26 + Logy * ((Logyhml - Logy) / Logy);
214
+ delta26 -> delta21 + MLog1pZ * ((MPoly - MLog1pZ) / MLog1pZ);
215
+ delta24 -> delta23 + delta22 + Logover * ((Loghml - Logover) / Logover);
216
+
217
+ ((logh + logm + logl) - MLog) / MLog -> ((Loghml - MLog) / MLog) + ((((logh + logm + logl) - Loghml) / Loghml) * (((Loghml - MLog) / MLog) + 1));
@@ -0,0 +1,156 @@
1
+
2
+
3
+
4
+ log2h = <float64ne> (_log2h);
5
+ log2m = <float64ne> (_log2m);
6
+ log2l = <float64ne> (_log2l);
7
+
8
+ c3 = <float64ne> (_c3);
9
+ c4 = <float64ne> (_c4);
10
+ c5 = <float64ne> (_c5);
11
+ c6 = <float64ne> (_c6);
12
+ c7 = <float64ne> (_c7);
13
+
14
+
15
+ E = 1; #MAPLE
16
+
17
+ logih = <float64ne> (_logih);
18
+ logim = <float64ne> (_logim);
19
+ logil = <float64ne> (_logil);
20
+
21
+
22
+ zh = <float64ne> (Z);
23
+ zl = Z - zh; #MAPLE
24
+
25
+ polyHorner <float64ne>= c3 + zh * (c4 + zh * (c5 + zh * (c6 + zh * c7)));
26
+
27
+ ZhSquarehl = zh * zh; #MAPLE
28
+ zhSquareh = <float64ne> (ZhSquarehl);
29
+ zhSquarel = <float64ne> (ZhSquarehl - zhSquareh);
30
+
31
+ zhSquareHalfh = zhSquareh * (-0.5); #MAPLE
32
+ zhSquareHalfl = zhSquarel * (-0.5); #MAPLE
33
+ ZhSquareHalfhl = ZhSquarehl * (-0.5); #MAPLE
34
+
35
+ polyUpper <float64ne>= polyHorner * (zh * zhSquareh);
36
+
37
+
38
+ temp = <float64ne> (zh * zl);
39
+ T1hl = polyUpper - temp; #MAPLE
40
+ t1h = <float64ne> (T1hl);
41
+ t1l = <float64ne> (T1hl - t1h);
42
+
43
+ T2 = Z + ZhSquareHalfhl; #MAPLE
44
+ t2h = <float64ne> (T2hl);
45
+ t2l = <float64ne> (T2hl - t2h);
46
+
47
+ PE = T2hl + T1hl; #MAPLE
48
+ ph = <float64ne> (Phl);
49
+ pl = <float64ne> (Phl - ph);
50
+
51
+ Log2hed = E * log2h; #MAPLE
52
+ Log2med = E * log2m; #MAPLE
53
+
54
+ Log2edhm = Log2hed + Log2med; #MAPLE
55
+ log2edh = <float64ne> (Log2edhm);
56
+ log2edl = <float64ne> (Log2edhm - log2edh);
57
+
58
+ #Useful additional definitions
59
+ Log2hm = log2h + log2m; #MAPLE
60
+ Logihm = logih + logim; #MAPLE
61
+ #End additional
62
+
63
+ LogTabPoly = Logihm + Phl; #MAPLE
64
+ logTabPolyh = <float64ne> (LogTabPolyhl);
65
+ logTabPolyl = <float64ne> (LogTabPolyhl - logTabPolyh);
66
+
67
+ LogE = Log2edhm + LogTabPolyhl; #MAPLE
68
+ logh = <float64ne> (Loghm);
69
+ logm = <float64ne> (Loghm - logh);
70
+
71
+ #Mathematical definition of the logarithm and the polynomial
72
+
73
+ Phigher = (c3 + Z * (c4 + Z * (c5 + Z * (c6 + Z * c7)))); #MAPLE
74
+ ZZZ = Z*Z*Z; #MAPLE
75
+ ZZZPhigher = ZZZ * Phigher; #MAPLE
76
+ HZZ = (-0.5*Z*Z); #MAPLE
77
+ ZpHZZ = Z + HZZ; #MAPLE
78
+ P = ZpHZZ + ZZZPhigher; #MAPLE
79
+ Log2E = E * Log2; #MAPLE
80
+ Log1pZpTab = Log1pZ + Logir; #MAPLE
81
+ Log = Log2E + Log1pZpTab; #MAPLE
82
+
83
+ # Useful additional definitions
84
+
85
+ HZZsimp = HZZ + (zh * zl); #MAPLE
86
+ ZpHZZsimp = Z + HZZsimp; #MAPLE
87
+ ZZZPhigherPzhzl = ZZZPhigher - zh * zl; #MAPLE
88
+ zhCube = zh * zhSquareh; #MAPLE
89
+
90
+ delta1 = T2hl - T2; #MAPLE
91
+ delta2 = polyUpper - (polyHorner * zhCube); #MAPLE
92
+ delta3 = zhCube - ZZZ; #MAPLE
93
+ delta4 = Phl - PE; #MAPLE
94
+ delta5 = Loghm - LogE; #MAPLE
95
+ delta6 = P - Log1pZ; #MAPLE
96
+ delta7 = LogTabPolyhl - LogTabPoly; #MAPLE
97
+
98
+ # End additional
99
+
100
+
101
+ {
102
+ (T2hl - T2) / T2 in [-1b-103,1b-103]
103
+ /\ (Phl - PE) / PE in [-1b-103,1b-103]
104
+ /\ (LogTabPolyhl - LogTabPoly) / LogTabPoly in [-1b-103,1b-103]
105
+ /\ (Loghm - LogE) / LogE in [-1b-103,1b-103]
106
+ /\ (Log2hm - Log2) / Log2 in [-1b-84,1b-84]
107
+ /\ (Logihm - Logir) / Logir in [-1b-106,1b-106]
108
+ /\ Z in [_zmin,_zmax]
109
+ /\ (P - Log1pZ) / Log1pZ in [-_epsilonApproxQuick,_epsilonApproxQuick]
110
+ /\ ((logh + logm) - Loghm) / Loghm in [-1b-106,1b-106]
111
+ ->
112
+ ((logh + logm) - Log) / Log in [-5b-65,5b-65]
113
+ }
114
+
115
+ T2hl - T2 -> ((T2hl - T2) / T2) * T2;
116
+ T2hl -> (T2hl - T2) + T2;
117
+
118
+ Phl - PE -> ((Phl - PE) / PE) * PE;
119
+ Phl -> (Phl - PE) + PE;
120
+
121
+
122
+ LogTabPolyhl -> (LogTabPolyhl - LogTabPoly) + LogTabPoly;
123
+
124
+ Loghm -> (Loghm - LogE) + LogE;
125
+
126
+ Log2 -> Log2hm * (1 / (((Log2hm - Log2) / Log2) + 1));
127
+
128
+ Logir -> Logihm * (1 / (((Logihm - Logir) / Logir) + 1));
129
+
130
+
131
+ LogTabPolyhl - LogTabPoly -> ((LogTabPolyhl - LogTabPoly) / LogTabPoly) * LogTabPoly;
132
+
133
+ HZZsimp -> (-0.5 * zh * zh) - (0.5 * zl * zl);
134
+
135
+ T2hl - ZpHZZsimp -> (0.5 * zl * zl) + delta1;
136
+
137
+ zhCube - ZZZ -> (Z * (zhSquareh - Z * Z)) - (zl * zhSquareh);
138
+
139
+ polyUpper - ZZZPhigher -> ZZZ * (polyHorner - Phigher) + polyHorner * delta3 + delta2;
140
+
141
+ ZpHZZ + ZZZPhigher -> ZpHZZsimp + ZZZPhigherPzhzl;
142
+
143
+ Phl - P -> (T2hl - ZpHZZsimp) + (T1hl - ZZZPhigherPzhzl) + delta4;
144
+
145
+ Log1pZ -> P * (1 / (((P - Log1pZ) / Log1pZ) + 1));
146
+ P - Log1pZ -> ((P - Log1pZ) / Log1pZ) * Log1pZ;
147
+
148
+ Phl - Log1pZ -> (Phl - P) + delta6;
149
+
150
+ LogTabPolyhl - Log1pZpTab -> (Logihm - Logir) + (Phl - Log1pZ) + delta7;
151
+
152
+ Loghm - Log -> (Log2edhm - Log2E) + (LogTabPolyhl - Log1pZpTab) + delta5;
153
+
154
+ (logh + logm) - Loghm -> (((logh + logm) - Loghm) / Loghm) * Loghm;
155
+
156
+ (logh + logm) - Log -> ((logh + logm) - Loghm) + (Loghm - Log);
@@ -0,0 +1,204 @@
1
+ # Usage: You need to set the constants cah, cal, sah, sal. Running the trigo.mpl Maple script
2
+ # should create 64 files in TEMPTRIG, which can be tested independently as
3
+ # sed -f TEMPTRIG/SinACosA_1.sed trigoSinCosCase3.gappa | ~/gappa/src/gappa > /dev/null
4
+
5
+ # NOTATION CONVENTION
6
+ # Variables that correspond to double-precision variables in the code begin with a small letter
7
+ # Other variables begin with a capital letter.
8
+ # Variables that will be replaced with Maple-computed constants begin with an underscore
9
+ # Otherwise avoid underscores as they are painful to carry on to LaTeX :)
10
+
11
+ # polynomial coefficients, computed by Maple
12
+ s3 = <float64ne>(_s3);
13
+ s5 = <float64ne>(_s5);
14
+ s7 = <float64ne>(_s7);
15
+ c2 = <float64ne>(_c2);
16
+ c4 = <float64ne>(_c4);
17
+ c6 = <float64ne>(_c6);
18
+
19
+ # Table values, computed by Maple
20
+ cah = <float64ne>(_cah);
21
+ cal = <float64ne>(_cal);
22
+ sah = <float64ne>(_sah);
23
+ sal = <float64ne>(_sal);
24
+
25
+ # The variables used here:
26
+ # x input
27
+ # Y perfect reduced argument
28
+ # Ydd = yh+yl, his distance to Y is specified as an hypothesis
29
+ # TsHat perfect ts
30
+ # TcHat perfect tc
31
+ # SinX exact result for sin(x)
32
+ # SinA, CosA perfect sin(kPi/256) and cos(kPi/256)
33
+
34
+
35
+ yh = <float64ne>(Ydd);
36
+ yl = Ydd - yh;
37
+
38
+ #######################################################################
39
+
40
+ # First, a transcription of the actual computation, which could (and
41
+ # should eventually) be generated automatically from the actual code
42
+
43
+ # ---------------------Code shared by sin and cos, cut from ComputeTrigWithArgRed :
44
+ yh2 <float64ne>= yh * yh;
45
+ ts <float64ne>= yh2 * (s3 + yh2*(s5 + yh2*s7));
46
+ tc <float64ne>= yh2 * (c2 + yh2*(c4 + yh2*c6));
47
+
48
+ # ---------------------Code for the sine, cut from DosinNotZero:
49
+ # Mul12(&cahyh_h,&cahyh_l, cah, yh);
50
+ cahyh = cah * yh;
51
+ cahyh_h = <float64ne>(cahyh);
52
+ cahyh_l = cahyh - cahyh_h; # Exact equation because Mul12 is exact
53
+
54
+ # Add12(thi, tlo, sah, cahyh_h);
55
+ TSin = sah + cahyh_h;
56
+ thiSin = <float64ne>(TSin);
57
+ tloSin1 = TSin - thiSin; # Exact equation because Add12 is exact
58
+
59
+ # Rem: need to Rename tlo to tloSin1, and its second use to tloSin2.
60
+ # It would be safer to translate code to single-assignment before
61
+ # using Gappa, modern compilers won't make any difference.
62
+
63
+ # tlo = tc*sah+(ts*cahyh_h+(sal+(tlo+(cahyh_l+(cal*yh + cah*yl))))) ;
64
+ tloSin2 <float64ne>= tc*sah + (ts*cahyh_h + (sal + (tloSin1 + (cahyh_l + (cal*yh + cah*yl)))));
65
+
66
+ # Add12(*reshi, *reslo, thi, tlo);
67
+ ResultSin = thiSin + tloSin2; # we don't need to split it for the proof.
68
+
69
+
70
+ # ---------------------Code for the cos, cut from DoCosNotZero:
71
+ # Mul12(&sahyh_h,&sahyh_l, sah, yh);
72
+ sahyh = sah * yh;
73
+ sahyh_h = <float64ne>(sahyh);
74
+ sahyh_l = sahyh - sahyh_h; # Exact equation because Mul12 is exact
75
+
76
+ # Add12(thi, tlo, cah, -sahyh_h);
77
+ TCos = cah - sahyh_h;
78
+ thiCos = <float64ne>(TCos);
79
+ tloCos1 = TCos - thiCos; # Exact equation because Add12 is exact
80
+
81
+ # tlo = tc*sah+(ts*cahyh_h+(sal+(tlo+(cahyh_l+(cal*yh + cah*yl))))) ;
82
+ tloCos2 <float64ne>= tc*cah-(ts*sahyh_h-(cal+(tloCos1-(sahyh_l+(sal*yh+sah*yl))))) ;
83
+
84
+ # Add12(*pch, *pcl, thi, tlo);
85
+ ResultCos = thiCos + tloCos2; # No need to split it for the proof.
86
+
87
+
88
+ #######################################################################
89
+
90
+ # Now let us pile up layers of approximations
91
+
92
+ #-------------------------------------
93
+ #With these notations, the exact sine and cosine are given by these
94
+ #exact mathematical formulae
95
+
96
+ SinX = SinY * CosA + CosY * SinA;
97
+ CosX = CosY * CosA - SinY * SinA;
98
+
99
+ #-------------------------------------
100
+ # yh2 is an approximation to :
101
+ Y2 = Y*Y;
102
+ # through three layers:
103
+ # 1/ Ydd=yh+hl = Y +/- delta_ArgRed : in the hypotheses below
104
+ # 2/ yh = Ydd - yl : already written
105
+ # 3/ rounding error in the mult : already written
106
+
107
+ #-------------------------------------
108
+ # ts is an approximation to :
109
+ TsHat = Y2 * (s3 + Y2*(s5 + Y2*s7));
110
+ # through two layers:
111
+ # 1/ the approximation y2 of Y2 : done just above
112
+ # 2/ the rounding errors in Horner : already written
113
+
114
+ #-------------------------------------
115
+ PolySinY = Y * (1 + TsHat);
116
+ # PolySinY is an approximation to sin(Y) as expressed in the hypotheses below :
117
+ # PolySinY - SinY in [-0.24126e-23, 0.24126e-23] # delta_approx_Sin_Case3
118
+
119
+ #-------------------------------------
120
+ # Same for PolyCosY
121
+ TcHat = Y2 * (c2 +(Y2 * (c4 + (Y2 * c6))));
122
+ PolyCosY = 1 + TcHat;
123
+
124
+ #-------------------------------------
125
+ #tc is an approximation to TcHat through the rounding errors, defined
126
+ #in the definition of tc. Same for ts
127
+
128
+ #-------------------------------------
129
+ # SinReconstrExact is an approximation to ResultSin
130
+ SinReconstrExact = PolySinY * CosA + PolyCosY * SinA ;
131
+ # The delta between ResultSin and SinReconstrExact is due to the two
132
+ # mathematical poly approx, and has been defined just above
133
+ CosReconstrExact = PolyCosY * CosA - PolySinY * SinA ;
134
+
135
+ #-------------------------------------
136
+ # The reconstruction approximates the following
137
+ SinReconstrNoRound = Ydd*(1 + ts)*(cah+cal) + (1 + tc)*(sah+sal);
138
+ # where Ydd is an approximation to Y
139
+ # ts is an approximation to TsHat
140
+ # tc is an approximation to TcHat : all already described
141
+ # All what we still need to express is that the actual computation will neglect some terms
142
+ CosReconstrNoRound = ( (1 + tc) * (cah+cal) - Ydd * (1 + ts) * (sah+sal) );
143
+
144
+ #-------------------------------------
145
+ # tloSin2 is an approximation to TloSin2NoRound (because of rounding error in the operations, already described)
146
+ TloSin2NoRound = tc*sah+(ts*cahyh_h+(sal+(tloSin1+(cahyh_l+(cal*yh+cah*yl))))) ;
147
+ TloCos2NoRound = tc*cah-(ts*sahyh_h-(cal+(tloCos1-(sahyh_l+(sal*yh+sah*yl)))));
148
+
149
+ # tloSinNoRound is an approximation to SinReconstrNoRound - tSinhi, the
150
+ # difference being the neglected terms. This error will be given as an hint
151
+
152
+ NeglectedSinTerms = SinReconstrNoRound - (thiSin + TloSin2NoRound);
153
+ NeglectedCosTerms = CosReconstrNoRound - (thiCos + TloCos2NoRound);
154
+
155
+ # And finally, ResultSin is an approximation to SinX through many layers which are given in the hints.
156
+
157
+ ###########################################################################################
158
+ # The theorem to prove
159
+ {
160
+ Ydd in [-_ymaxCase3, _ymaxCase3] # computed by Maple
161
+ /\ Ydd - Y in [-_delta_ArgRed, _delta_ArgRed] # computed by Maple
162
+ /\ PolySinY - SinY in [-_delta_approx_Sin_Case3, _delta_approx_Sin_Case3] # computed by Maple
163
+ /\ PolyCosY - CosY in [-_delta_approx_Cos_Case3, _delta_approx_Cos_Case3] # computed by Maple
164
+ /\ SinA-sah-sal in [-1b-104, 1b-104]
165
+ /\ CosA-cah-cal in [-1b-104, 1b-104] # double-double absolute rounding error, with margin
166
+
167
+ ->
168
+
169
+ (ResultSin - SinX)/SinX in [-3b-66,3b-66]
170
+ /\
171
+ (ResultCos - CosX)/CosX in [-3b-66,3b-66]
172
+
173
+
174
+ }
175
+
176
+ #(ResultSin - SinX)/SinX $ SinX;
177
+
178
+ ###########################################################################################
179
+ # Hints to the reduction engine: Gappa is not supposed to be clever, it's an assistant
180
+
181
+ # To get bounds on SinX, try ResultSin
182
+ SinX -> ResultSin - (ResultSin - SinX);
183
+ CosX -> ResultCos - (ResultCos - CosX);
184
+
185
+ # To get bounds on SinA, try sah+sal
186
+ SinA -> sah + sal + (SinA - sah - sal);
187
+ CosA -> cah + cal + (CosA - cah - cal);
188
+
189
+ # To get bounds on Y, try Ydd
190
+ Y -> Ydd - (Ydd - Y);
191
+
192
+ # One layer of approx error, and one layer of rounding error for SinY and CosY
193
+ 1 + tc - CosY -> (1 + tc - PolyCosY) + (PolyCosY - CosY);
194
+ (Y + Y * ts) - SinY -> ((Y + Y * ts) - PolySinY) + (PolySinY - SinY);
195
+
196
+ # Layers of approximations
197
+ ResultSin - SinX -> (ResultSin - SinReconstrNoRound) + (SinReconstrNoRound - SinReconstrExact) + (SinReconstrExact - SinX);
198
+ ResultCos - CosX -> (ResultCos - CosReconstrNoRound) + (CosReconstrNoRound - CosReconstrExact) + (CosReconstrExact - CosX);
199
+
200
+ NeglectedSinTerms -> sal*tc + cal*yl + ts*(cahyh_l + cah*yl + cal*yh + cal*yl);
201
+ ResultSin - SinReconstrNoRound -> (ResultSin - (thiSin + TloSin2NoRound)) - (SinReconstrNoRound - (thiSin + TloSin2NoRound)) ;
202
+
203
+ NeglectedCosTerms -> cal*tc - sal*yl - ts*(sahyh_l + sah*yl + sal*yh + sal*yl);
204
+ ResultCos - CosReconstrNoRound -> (ResultCos - (thiCos + TloCos2NoRound)) - (CosReconstrNoRound - (thiCos + TloCos2NoRound)) ;
@@ -0,0 +1,73 @@
1
+ # Usage: You need to replace a few constants (beginning by _) by numerical
2
+ # values. Running the trigo.mpl Maple script will generate a
3
+ # TEMPTRIG/tanCase2.sed sed script that does it.
4
+ # Then sed -f TEMPTRIG/TanCase2.sed trigoTanCase2.gappa | gappa > /dev/null
5
+
6
+
7
+ # NOTATION CONVENTION
8
+ # Variables that correspond to double-precision variables in the code begin with a small letter
9
+ # Other variables begin with a capital letter.
10
+ # Otherwise avoid underscores as they are painful to carry on to LaTeX :)
11
+
12
+
13
+
14
+ # Definition of the polynomial constants:
15
+ t11 = <float64ne>(_t11);
16
+ t9 = <float64ne>(_t9);
17
+ t7 = <float64ne>(_t7);
18
+ t5 = <float64ne>(_t5);
19
+ t3h = <float64ne>(_t3h);
20
+ t3l = <float64ne>(_t3l);
21
+
22
+ #######################################################################
23
+
24
+ # First, a transcription of the actual computation, which could (and
25
+ # should eventually) be generated automatically from the actual code
26
+
27
+ # ---------------------Code cut from tan_rn :
28
+ # x2 = x*x;
29
+ x2 <float64ne>= x * x;
30
+ X2 = x*x;
31
+
32
+ # p5 = t5 + x2*(t7 + x2*(t9 + x2*t11));
33
+ p5 <float64ne>= t5 + x2*(t7 + x2*(t9 + x2*t11));
34
+ P5 = t5 + X2*(t7 + X2*(t9 + X2*t11));
35
+
36
+ # tt = x2*(t3h + (t3l + x2*p5));
37
+ tt <float64ne>= x2*(t3h + (t3l + x2*p5));
38
+ Tt = X2*(t3h + (t3l + X2*p5));
39
+
40
+ # Add12(rri.rh, rri.rl, x, x*tt);
41
+ rdd = x + <float64ne>(x*tt); # The Add12 is exact
42
+
43
+ Poly = x+x*Tt;
44
+
45
+ epsilon=(rdd - TanX)/TanX;
46
+
47
+ {
48
+ x in [1b-30, _xmax]
49
+ /\ (Poly - TanX)/TanX in [-_maxEpsApprox, _maxEpsApprox]
50
+ /\ ((Poly - TanX)/TanX)/x in [-_maxEpsApproxOverX, _maxEpsApproxOverX]
51
+
52
+ ->
53
+
54
+ epsilon in ?
55
+ /\
56
+ epsilon/x in [-1b-56,1b-56]
57
+
58
+ }
59
+
60
+ # Use a dichotomy on x to get an interval of epsilon/x
61
+ epsilon/x $ x;
62
+
63
+ # The usual hint for relative errors, with an additional /x*x so that Gappa uses the Maple-computed mathematical bound
64
+ (rdd - TanX)/TanX -> (rdd - Poly)/Poly + (((Poly - TanX)/TanX)/x)*x + ((rdd - Poly)/Poly) * ((Poly - TanX)/TanX) ;
65
+
66
+ (rdd - Poly)/Poly -> ((<float64ne>(x*tt) - x*Tt) / x) * (x/Poly);
67
+
68
+ # I'm not sure I understand why this one improves the result
69
+ (<float64ne>(x*tt) - x*Tt)/x -> ((<float64ne>(x*tt) - x*tt)/(x*tt)) * tt + (tt - Tt);
70
+
71
+ # Easy hints
72
+ x/Poly -> 1/(Poly/x);
73
+ Poly/x -> 1+Tt;