-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsrcmain.cpp
372 lines (363 loc) · 54.6 KB
/
srcmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
#include "derivest.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
void check(double cpp_der, double cpp_err, double mat_der, double mat_err, double true_der) {
int err_code = 0;
static int lines = 0;
static int wins = 0;
static int lose = 0;
bool cpp_wins = (fabs(cpp_der - true_der) <= fabs(mat_der - true_der));
if (cpp_wins) wins++; else lose++;
if (false) {
printf(cpp_wins ? "+" : "-");
if ((lines++) > 77) {
printf(" CPP:%i, MAT:%i\n", wins, lose);
wins = 0; lose = 0; lines = 0;
}
}
printf("F'cpp=%.6f F'mat=%.6f hatErrCpp=%.6e hatErrMat=%.6e F'true=%.6f err(F'cpp)=%.6e err(F'mat)=%.6e\n",
cpp_der, mat_der, cpp_err, mat_err, true_der, cpp_der - true_der, mat_der - true_der);
}
int main() {
double der=0.0, err = 0.0, finaldelta = 1.0;
auto exp = [](double x) {return std::exp(x); };
auto poly = [](double x) {return x + x*x + x*x*x + x*x*x*x + x*x*x*x*x; };
printf("f(x) = exp(x); x0 = 1;\n");
derivest(exp, 1, 1, 4, DerivestStyle_Central, 2, &der, &err, NULL); printf("f'(x) = %.17f, err=%.3e, hat(err)=%.3e\n", der, der - exp(1), err);
derivest(exp, 1, 2, 4, DerivestStyle_Central, 2, &der, &err, NULL); printf("f''(x) = %.17f, err=%.3e, hat(err)=%.3e\n", der, der - exp(1), err);
derivest(exp, 1, 3, 4, DerivestStyle_Central, 2, &der, &err, NULL); printf("f'''(x) = %.17f, err=%.3e, hat(err)=%.3e\n", der, der - exp(1), err);
derivest(exp, 1, 4, 4, DerivestStyle_Central, 2, &der, &err, NULL); printf("f''''(x) = %.17f, err=%.3e, hat(err)=%.3e\n", der, der - exp(1), err);
printf("\nf(x) = x + x*x + x*x*x + x*x*x*x + x*x*x*x*x; x0 = 0.0;\n");
derivest(poly, 0, 1, 4, DerivestStyle_Central, 2, &der, &err, NULL); printf("f'(x) = %.17f, err=%.3e, hat(err)=%.3e\n", der, der - 1, err);
derivest(poly, 0, 2, 4, DerivestStyle_Central, 2, &der, &err, NULL); printf("f''(x) = %.17f, err=%.3e, hat(err)=%.3e\n", der, der - 2, err);
derivest(poly, 0, 3, 4, DerivestStyle_Central, 2, &der, &err, NULL); printf("f'''(x) = %.17f, err=%.3e, hat(err)=%.3e\n", der, der - 6, err);
derivest(poly, 0, 4, 4, DerivestStyle_Central, 2, &der, &err, NULL); printf("f''''(x) = %.17f, err=%.3e, hat(err)=%.3e\n", der, der - 24, err);
// Rosenbrock function, minimized at[1, 1]
auto rosen = [](double* x) { return pow(x[0] - 1, 2) + 105 * pow(x[1] - x[0] * x[0], 2); };
double x1vec[] = { 1, 1 };
double hess[4], hess_err[4];
hessian(rosen, x1vec, 2, hess, hess_err);
printf("\nrosen(x,y) = (1-x)^2 + 105 * (y - x^2)^2\n");
printf("hess(rosen) = [%.8f %.8f; %.8f %.8f]\n", hess[0], hess[1], hess[2], hess[3]);
printf("hess_err(rosen) = [%.7e %.7e; %.7e %.7e]\n", hess_err[0], hess_err[1], hess_err[2], hess_err[3]);
return 0;
derivest(exp, 1, 1, 2, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.71828182910204320000, 0.00000000487257430573, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.71828182845951940000, 0.00000000000076733299, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845904420000, 0.00000000000006613091, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845905400000, 0.00000000000004389977, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.71828181431609920000, 0.00000013431187142050, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.71828182809071000000, 0.00000000307388773607, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845728120000, 0.00000000003505374050, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845631530000, 0.00000000002667293904, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.71828022764691780000, 0.00001012076873281049, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.71828182574754160000, 0.00000003443939930317, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.71828182839895400000, 0.00000000060923812458, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.71828182842871740000, 0.00000000016664192415, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.72098383922515330000, 0.02060526519211821800, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.71828186851933660000, 0.00000093456256656499, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.71828465269775550000, 0.00002584370610098787, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.71828182839686820000, 0.00000001398275403113, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.71828182845951800000, 0.00000000000098189264, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.71828182845904330000, 0.00000000000008472847, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845905440000, 0.00000000000005633990, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845905570000, 0.00000000000004173637, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.71828182809070730000, 0.00000000390682818240, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.71828182845728120000, 0.00000000004434481922, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845631530000, 0.00000000003370326617, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845865520000, 0.00000000000622983443, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.71828182577612590000, 0.00000004398146937944, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.71828182840607370000, 0.00000000070313826878, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.71828182842988000000, 0.00000000020706751526, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.71828182843923740000, 0.00000000031744847107, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.71828186850925930000, 0.00000118774750294165, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.71828274062198670000, 0.00000914679438096250, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.71828182839617360000, 0.00000001766512542244, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.71828275733578110000, 0.00000913123052702803, 2.71828182845904550000);
derivest(exp, 1, 1, 1, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71833043570328000000, 0.00020587349224618427, 2.71828182845904550000);
derivest(exp, 1, 1, 1, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182329373820000, 0.00000002567154252126, 2.71828182845904550000);
derivest(exp, 1, 1, 1, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845678730000, 0.00000000007663699969, 2.71828182845904550000);
derivest(exp, 1, 1, 1, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182843945540000, 0.00000000002096849719, 2.71828182845904550000);
derivest(exp, 1, 2, 1, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71837943251424900000, 0.00041059933045463251, 2.71828182845904550000);
derivest(exp, 1, 2, 1, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828153053694880000, 0.00000135086696382272, 2.71828182845904550000);
derivest(exp, 1, 2, 1, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828183903684330000, 0.00000006149505009311, 2.71828182845904550000);
derivest(exp, 1, 2, 1, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182804416500000, 0.00000000198457088005, 2.71828182845904550000);
derivest(exp, 1, 3, 1, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71966930755408680000, 0.00540937714607603920, 2.71828182845904550000);
derivest(exp, 1, 3, 1, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71822612212756630000, 0.00027867115060656696, 2.71828182845904550000);
derivest(exp, 1, 3, 1, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828229817838980000, 0.00000238018572171834, 2.71828182845904550000);
derivest(exp, 1, 3, 1, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828007970599030000, 0.00000995314210921011, 2.71828182845904550000);
derivest(exp, 1, 4, 1, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.79426848017645120000, 0.32636911603230501000, 2.71828182845904550000);
derivest(exp, 1, 4, 1, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71761366892057810000, 0.00334891821111264020, 2.71828182845904550000);
derivest(exp, 1, 4, 1, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.72308236800488150000, 0.03782376157060058500, 2.71828182845904550000);
derivest(exp, 1, 4, 1, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71795808996065040000, 0.00188144700654547650, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71828182715038480000, 0.00000000978943243017, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182845678730000, 0.00000000010949566508, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182843512240000, 0.00000000000967515059, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845911660000, 0.00000000000105759387, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71828217000001620000, 0.00000168367744655471, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828183051183240000, 0.00000000261799037509, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182804520150000, 0.00000000273278001380, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182846500830000, 0.00000000029420937929, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71822612229262230000, 0.00042567705324013112, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828229836218100000, 0.00000340125810515070, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828007972743050000, 0.00001377255687277511, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828184816228500000, 0.00000013133447202008, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71800949671585060000, 0.00251325777084757030, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71969016902184930000, 0.01120112184244186900, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71826528999722460000, 0.00013993344020257019, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.72420384073332270000, 0.05624041266239784800, 2.71828182845904550000);
derivest(exp, 1, 1, 3, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71828182845678510000, 0.00000000013917408883, 2.71828182845904550000);
derivest(exp, 1, 1, 3, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182843512240000, 0.00000000001215471898, 2.71828182845904550000);
derivest(exp, 1, 1, 3, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845911660000, 0.00000000000132179540, 2.71828182845904550000);
derivest(exp, 1, 1, 3, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845893320000, 0.00000000000027829290, 2.71828182845904550000);
derivest(exp, 1, 2, 3, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71828183051012880000, 0.00000000335383625307, 2.71828182845904550000);
derivest(exp, 1, 2, 3, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182804270390000, 0.00000000345532031382, 2.71828182845904550000);
derivest(exp, 1, 2, 3, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182846447050000, 0.00000000037055011272, 2.71828182845904550000);
derivest(exp, 1, 2, 3, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182848642900000, 0.00000000007792632656, 2.71828182845904550000);
derivest(exp, 1, 3, 3, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71828229868771220000, 0.00000431683859938511, 2.71828182845904550000);
derivest(exp, 1, 3, 3, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828172065578140000, 0.00000110739087677810, 2.71828182845904550000);
derivest(exp, 1, 3, 3, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828183005048320000, 0.00000002520627908108, 2.71828182845904550000);
derivest(exp, 1, 3, 3, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828178611778040000, 0.00000030781012643753, 2.71828182845904550000);
derivest(exp, 1, 4, 3, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71969016978165580000, 0.01423636894608317300, 2.71828182845904550000);
derivest(exp, 1, 4, 3, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71826529455358350000, 0.00017597350826990371, 2.71828182845904550000);
derivest(exp, 1, 4, 3, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.72422076890458920000, 0.07044484878932928700, 2.71828182845904550000);
derivest(exp, 1, 4, 3, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71809971871679590000, 0.00183784654900805640, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71828182843512160000, 0.00000000001375406026, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182845911840000, 0.00000000000149106125, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845893450000, 0.00000000000031316144, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845891100000, 0.00000000000013716977, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71828182804301570000, 0.00000000391180503358, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182846461090000, 0.00000000041481593189, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182848646050000, 0.00000000009069714476, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845259380000, 0.00000000029379190899, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71828172055705910000, 0.00000125274739985151, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182994761700000, 0.00000002803808701062, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71828178607862810000, 0.00000034723015229470, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.71828184931429460000, 0.00000018924143538854, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.71827447079582110000, 0.00007144395721836164, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.71843526392034600000, 0.00175222235382081390, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.71827382613972720000, 0.00007074671499010571, 2.71828182845904550000);
derivest(exp, 1, 1, 1, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71823322250080630000, 0.00020586374709475149, 2.71828182845904550000);
derivest(exp, 1, 1, 1, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182331422410000, 0.00000002571157446973, 2.71828182845904550000);
derivest(exp, 1, 1, 1, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845839410000, 0.00000000003952616487, 2.71828182845904550000);
derivest(exp, 1, 1, 1, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182846059140000, 0.00000000000073024612, 2.71828182845904550000);
derivest(exp, 1, 2, 1, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71818536798474990000, 0.00042025714694037485, 2.71828182845904550000);
derivest(exp, 1, 2, 1, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828191029565720000, 0.00000024497230044149, 2.71828182845904550000);
derivest(exp, 1, 2, 1, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828183103582430000, 0.00000000360323363653, 2.71828182845904550000);
derivest(exp, 1, 2, 1, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182762515260000, 0.00000000240347072978, 2.71828182845904550000);
derivest(exp, 1, 3, 1, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71690604315224030000, 0.00553800393016253430, 2.71828182845904550000);
derivest(exp, 1, 3, 1, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828184704527320000, 0.00000843006073819960, 2.71828182845904550000);
derivest(exp, 1, 3, 1, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828127213506710000, 0.00000149793748093661, 2.71828182845904550000);
derivest(exp, 1, 3, 1, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828174541399430000, 0.00000058995377306125, 2.71828182845904550000);
derivest(exp, 1, 4, 1, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.70981764405670190000, 0.05058693172527270500, 2.71828182845904550000);
derivest(exp, 1, 4, 1, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71808579464560520000, 0.00050076182793128859, 2.71828182845904550000);
derivest(exp, 1, 4, 1, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71823346722331260000, 0.00033121112617083895, 2.71828182845904550000);
derivest(exp, 1, 4, 1, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71822884998332940000, 0.00036299060127072168, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828182719380650000, 0.00000001001970208062, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182846498080000, 0.00000000000936172880, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182846059050000, 0.00000000000099845299, 2.71828182845904550000);
derivest(exp, 1, 1, 2, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182846091160000, 0.00000000000165133998, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828191027862510000, 0.00000037412856697484, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828183103252700000, 0.00000000512266107235, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182762574320000, 0.00000000333066377512, 2.71828182845904550000);
derivest(exp, 1, 2, 2, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182828442260000, 0.00000000199466578091, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828184774119790000, 0.00001287054888745099, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828127229819930000, 0.00000213744870682812, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828174566480520000, 0.00000081865418812459, 2.71828182845904550000);
derivest(exp, 1, 3, 2, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828183690862750000, 0.00000010696997771373, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71808574624631480000, 0.00076467953434361925, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71826576916223630000, 0.00014992482895879710, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71826971932239130000, 0.00009771393275244667, 2.71828182845904550000);
derivest(exp, 1, 4, 2, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71823639448478490000, 0.00035351809433819631, 2.71828182845904550000);
derivest(exp, 1, 1, 3, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828182846497900000, 0.00000000001190043523, 2.71828182845904550000);
derivest(exp, 1, 1, 3, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182846059100000, 0.00000000000126082644, 2.71828182845904550000);
derivest(exp, 1, 1, 3, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182846091160000, 0.00000000000205492244, 2.71828182845904550000);
derivest(exp, 1, 1, 3, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845902870000, 0.00000000000189698001, 2.71828182845904550000);
derivest(exp, 1, 2, 3, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828183103599620000, 0.00000000654120755497, 2.71828182845904550000);
derivest(exp, 1, 2, 3, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182762556160000, 0.00000000418338888078, 2.71828182845904550000);
derivest(exp, 1, 2, 3, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182828423160000, 0.00000000249738135386, 2.71828182845904550000);
derivest(exp, 1, 2, 3, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182849993680000, 0.00000000040947171744, 2.71828182845904550000);
derivest(exp, 1, 3, 3, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828127256954800000, 0.00000272343980295460, 2.71828182845904550000);
derivest(exp, 1, 3, 3, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828174552636840000, 0.00000102744324365757, 2.71828182845904550000);
derivest(exp, 1, 3, 3, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828183675967240000, 0.00000013181576912828, 2.71828182845904550000);
derivest(exp, 1, 3, 3, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828184118332490000, 0.00000009080113541439, 2.71828182845904550000);
derivest(exp, 1, 4, 3, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71826574283537200000, 0.00019038751189969790, 2.71828182845904550000);
derivest(exp, 1, 4, 3, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828282701920680000, 0.00002448463739247149, 2.71828182845904550000);
derivest(exp, 1, 4, 3, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828016013910870000, 0.00002053844328335441, 2.71828182845904550000);
derivest(exp, 1, 4, 3, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71826336206361100000, 0.00017990714239353233, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828182846059050000, 0.00000000000141920625, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182846616780000, 0.00000000000061079031, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182845902950000, 0.00000000000215525024, 2.71828182845904550000);
derivest(exp, 1, 1, 4, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182845916810000, 0.00000000000070747854, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828182762635780000, 0.00000000474930413447, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828182828508200000, 0.00000000280679262626, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828182849992220000, 0.00000000045712849851, 2.71828182845904550000);
derivest(exp, 1, 2, 4, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182851301570000, 0.00000000031518170911, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828174547396720000, 0.00000116290251165030, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828183670625200000, 0.00000014914673754532, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828184112944490000, 0.00000010272428006068, 2.71828182845904550000);
derivest(exp, 1, 3, 4, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.71828182575342050000, 0.00000008184181934329, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.71828286943393180000, 0.00002811852252097720, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.71828374628076830000, 0.00001947368767550344, 2.71828182845904550000);
derivest(exp, 1, 4, 4, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.71828157771911540000, 0.00000767468189150057, 2.71828182845904550000);
derivest(poly, 0, 1, 2, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 1.00000000000056820000, 0.00000000000433358563, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 1.00000000000000020000, 0.00000000000000000000, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999989000, 0.00000000000000253455, 1.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 2.00000000001005020000, 0.00000000017271281793, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 2.00000000000000440000, 0.00000000000000479536, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.00000000000000440000, 0.00000000000000501337, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.00000000000000440000, 0.00000000000001681233, 2.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 6.00000002205805050000, 0.00000155509942400848, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 6.00000000000000980000, 0.00000000000013185068, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 5.99999999999997340000, 0.00000000000024845288, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 6.00000000000002400000, 0.00000000000068190344, 6.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 24.00000000000000000000, 0.00000000000019416096, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 24.00000000000006400000, 0.00000000000029467105, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 23.99999999999995700000, 0.00000000000122965640, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 23.99999999999630900000, 0.00000000000609805117, 24.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 0.99999999999999956000, 0.00000000000000315436, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 0.99999999999999989000, 0.00000000000000103235, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 0.99999999999999989000, 0.00000000000000104119, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999978000, 0.00000000000000361448, 1.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 1.99999999999999840000, 0.00000000000000719304, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 1.99999999999999910000, 0.00000000000000583987, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 2.00000000000000400000, 0.00000000000000416477, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 2.00000000000000400000, 0.00000000000000978805, 2.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 6.00000000000022120000, 0.00000000000002523487, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 6.00000000000249400000, 0.00000000002709864099, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 6.00000000001066610000, 0.00000000006852334069, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 6.00000000029444270000, 0.00000000142613251918, 6.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Central, 0, &der, &err, &finaldelta); check(der, err, 24.00000000000001100000, 0.00000000000010093948, 24.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Central, 1, &der, &err, &finaldelta); check(der, err, 23.99999999999982600000, 0.00000000000231742133, 24.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Central, 2, &der, &err, &finaldelta); check(der, err, 23.99999999999803900000, 0.00000000001860368973, 24.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Central, 3, &der, &err, &finaldelta); check(der, err, 23.99999999999455700000, 0.00000000002210466333, 24.00000000000000000000);
derivest(poly, 0, 1, 1, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 1.00000071525554230000, 0.00000302939658243334, 1.00000000000000000000);
derivest(poly, 0, 1, 1, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 0.99999999999545264000, 0.00000000002269597633, 1.00000000000000000000);
derivest(poly, 0, 1, 1, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 1.00000000000000040000, 0.00000000000000000000, 1.00000000000000000000);
derivest(poly, 0, 1, 1, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 1.00000000000000020000, 0.00000000000001048789, 1.00000000000000000000);
derivest(poly, 0, 2, 1, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.00000429185686590000, 0.00001817198088355098, 2.00000000000000000000);
derivest(poly, 0, 2, 1, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 1.99999999950590030000, 0.00000000195897412966, 2.00000000000000000000);
derivest(poly, 0, 2, 1, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.00000000001973890000, 0.00000000018541124429, 2.00000000000000000000);
derivest(poly, 0, 2, 1, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 1.99999999999999640000, 0.00000000000009726065, 2.00000000000000000000);
derivest(poly, 0, 3, 1, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 6.00014985720977820000, 0.00050802406566938826, 6.00000000000000000000);
derivest(poly, 0, 3, 1, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 5.99999613479397720000, 0.00002124941489195696, 6.00000000000000000000);
derivest(poly, 0, 3, 1, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 5.99999999999998490000, 0.00000000000013646545, 6.00000000000000000000);
derivest(poly, 0, 3, 1, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 5.99999999999952390000, 0.00000000000286294313, 6.00000000000000000000);
derivest(poly, 0, 4, 1, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 24.03206632973018800000, 0.15514770377647941000, 24.00000000000000000000);
derivest(poly, 0, 4, 1, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 23.99999999999928600000, 0.00000000000468211208, 24.00000000000000000000);
derivest(poly, 0, 4, 1, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 23.99999999999523600000, 0.00000000002178030626, 24.00000000000000000000);
derivest(poly, 0, 4, 1, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 23.99999999747423400000, 0.00000001504494906581, 24.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 0.99999999999886258000, 0.00000000000866364414, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 1.00000000000000020000, 0.00000000000000339083, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 0.99999999999999967000, 0.00000000000000396189, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999989000, 0.00000000000000605007, 1.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 1.99999999953852630000, 0.00000000231860888584, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 2.00000000001871660000, 0.00000000038757753863, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.00000000000000440000, 0.00000000000002011525, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 1.99999999999982330000, 0.00000000000005769727, 2.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 5.99999606545864150000, 0.00003201821613043800, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 5.99999999999994850000, 0.00000000000014257639, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 5.99999999999960920000, 0.00000000000291117688, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 5.99999999999542940000, 0.00000000003218428245, 6.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 24.00000000000230600000, 0.00000000000354540491, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 24.00000000000127200000, 0.00000000000580130316, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 24.00000000021168100000, 0.00000000188561928942, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 23.99999999719759500000, 0.00000001056400426263, 24.00000000000000000000);
derivest(poly, 0, 1, 3, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 0.99999999999999922000, 0.00000000000000315436, 1.00000000000000000000);
derivest(poly, 0, 1, 3, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 0.99999999999999956000, 0.00000000000000215169, 1.00000000000000000000);
derivest(poly, 0, 1, 3, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 0.99999999999999989000, 0.00000000000000316393, 1.00000000000000000000);
derivest(poly, 0, 1, 3, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999911000, 0.00000000000000456402, 1.00000000000000000000);
derivest(poly, 0, 2, 3, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 2.00000000001293410000, 0.00000000040097226066, 2.00000000000000000000);
derivest(poly, 0, 2, 3, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 1.99999999999999270000, 0.00000000000002886800, 2.00000000000000000000);
derivest(poly, 0, 2, 3, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 2.00000000000000090000, 0.00000000000006636713, 2.00000000000000000000);
derivest(poly, 0, 2, 3, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 2.00000000000008130000, 0.00000000000075084701, 2.00000000000000000000);
derivest(poly, 0, 3, 3, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 5.99999999999921660000, 0.00000000000424343676, 6.00000000000000000000);
derivest(poly, 0, 3, 3, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 5.99999999999919440000, 0.00000000000510652371, 6.00000000000000000000);
derivest(poly, 0, 3, 3, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 5.99999999999479080000, 0.00000000004108287565, 6.00000000000000000000);
derivest(poly, 0, 3, 3, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 6.00000000001701220000, 0.00000000027020503809, 6.00000000000000000000);
derivest(poly, 0, 4, 3, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 24.00000000019198900000, 0.00000000004674416711, 24.00000000000000000000);
derivest(poly, 0, 4, 3, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 24.00000000046113200000, 0.00000000296861448877, 24.00000000000000000000);
derivest(poly, 0, 4, 3, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 24.00000000449476500000, 0.00000007462464029726, 24.00000000000000000000);
derivest(poly, 0, 4, 3, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 24.00000014303921600000, 0.00000134298902586650, 24.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 0.99999999999999922000, 0.00000000000000446094, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 1.00000000000000000000, 0.00000000000000178809, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 0.99999999999999944000, 0.00000000000000105052, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999989000, 0.00000000000000617966, 1.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 1.99999999999999580000, 0.00000000000019203802, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 1.99999999999999620000, 0.00000000000020458314, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 1.99999999999975400000, 0.00000000000077474733, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 1.99999999999975090000, 0.00000000000082041885, 2.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 5.99999999998237590000, 0.00000000004768072918, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 5.99999999998259170000, 0.00000000005330977952, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 6.00000000000645970000, 0.00000000033124096680, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Forward, 3, &der, &err, &finaldelta); check(der, err, 5.99999999997576610000, 0.00000000068624398515, 6.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Forward, 0, &der, &err, &finaldelta); check(der, err, 23.99999999981521600000, 0.00000000429054228333, 24.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Forward, 1, &der, &err, &finaldelta); check(der, err, 23.99999999814194100000, 0.00000002454501421151, 24.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Forward, 2, &der, &err, &finaldelta); check(der, err, 24.00000000010856700000, 0.00000004809029460638, 24.00000000000000000000);
derivest(poly, 0, 1, 1, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 0.99999964237267236000, 0.00000151469496485185, 1.00000000000000000000);
derivest(poly, 0, 1, 1, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 0.99999999999545264000, 0.00000000002269597666, 1.00000000000000000000);
derivest(poly, 0, 1, 1, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 0.99999999999999978000, 0.00000000000000322369, 1.00000000000000000000);
derivest(poly, 0, 1, 1, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999956000, 0.00000000000001436113, 1.00000000000000000000);
derivest(poly, 0, 2, 1, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 1.99999570818846980000, 0.00001817047705207044, 2.00000000000000000000);
derivest(poly, 0, 2, 1, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.00000000013652280000, 0.00000000145160325996, 2.00000000000000000000);
derivest(poly, 0, 2, 1, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 1.99999999995838220000, 0.00000000002839099809, 2.00000000000000000000);
derivest(poly, 0, 2, 1, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 2.00000000000000360000, 0.00000000000011323153, 2.00000000000000000000);
derivest(poly, 0, 3, 1, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 5.99974771549474270000, 0.00086169081818200850, 6.00000000000000000000);
derivest(poly, 0, 3, 1, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 5.99999883762765230000, 0.00000174623401594542, 6.00000000000000000000);
derivest(poly, 0, 3, 1, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 5.99999999999987210000, 0.00000000000036289108, 6.00000000000000000000);
derivest(poly, 0, 3, 1, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 6.00000000000032240000, 0.00000000000310646860, 6.00000000000000000000);
derivest(poly, 0, 4, 1, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 23.98441353022266400000, 0.05642006126895014000, 24.00000000000000000000);
derivest(poly, 0, 4, 1, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 24.00000000000066400000, 0.00000000000484820006, 24.00000000000000000000);
derivest(poly, 0, 4, 1, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 24.00000000000664000000, 0.00000000003510133731, 24.00000000000000000000);
derivest(poly, 0, 4, 1, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 24.00000000821798100000, 0.00000005452024829123, 24.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 0.99999999999886258000, 0.00000000000866364414, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 1.00000000000000020000, 0.00000000000000207645, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 0.99999999999999944000, 0.00000000000000349406, 1.00000000000000000000);
derivest(poly, 0, 1, 2, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999978000, 0.00000000000000519335, 1.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.00000000007350740000, 0.00000000059847764076, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 1.99999999995516520000, 0.00000000003656157364, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 1.99999999999805000000, 0.00000000000002145772, 2.00000000000000000000);
derivest(poly, 0, 2, 2, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 1.99999999999999270000, 0.00000000000004246404, 2.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 5.99999855036796780000, 0.00000059575908370487, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 5.99999999999993340000, 0.00000000000052188003, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 6.00000000000007990000, 0.00000000000188099826, 6.00000000000000000000);
derivest(poly, 0, 3, 2, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 5.99999999999811260000, 0.00000000001863321253, 6.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 23.99999999999682400000, 0.00000000001776354164, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 24.00000000000887100000, 0.00000000009702694257, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 24.00000000004172700000, 0.00000000018204024569, 24.00000000000000000000);
derivest(poly, 0, 4, 2, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 24.00000000682643600000, 0.00000006094827842205, 24.00000000000000000000);
derivest(poly, 0, 1, 3, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 0.99999999999999956000, 0.00000000000000359652, 1.00000000000000000000);
derivest(poly, 0, 1, 3, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 0.99999999999999944000, 0.00000000000000263528, 1.00000000000000000000);
derivest(poly, 0, 1, 3, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 0.99999999999999956000, 0.00000000000000223724, 1.00000000000000000000);
derivest(poly, 0, 1, 3, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999967000, 0.00000000000000411395, 1.00000000000000000000);
derivest(poly, 0, 2, 3, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 1.99999999996829820000, 0.00000000007101746615, 2.00000000000000000000);
derivest(poly, 0, 2, 3, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 1.99999999999999160000, 0.00000000000006732429, 2.00000000000000000000);
derivest(poly, 0, 2, 3, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.00000000000000000000, 0.00000000000016597815, 2.00000000000000000000);
derivest(poly, 0, 2, 3, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 1.99999999999999760000, 0.00000000000019379622, 2.00000000000000000000);
derivest(poly, 0, 3, 3, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 6.00000000000035080000, 0.00000000000318816390, 6.00000000000000000000);
derivest(poly, 0, 3, 3, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 6.00000000000027440000, 0.00000000000273317623, 6.00000000000000000000);
derivest(poly, 0, 3, 3, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 6.00000000000022560000, 0.00000000000242093280, 6.00000000000000000000);
derivest(poly, 0, 3, 3, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 6.00000000000020160000, 0.00000000000224716648, 6.00000000000000000000);
derivest(poly, 0, 4, 3, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 23.99999473560235700000, 0.00007299185001796172, 24.00000000000000000000);
derivest(poly, 0, 4, 3, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 23.99994980166877300000, 0.00042157916611115244, 24.00000000000000000000);
derivest(poly, 0, 4, 3, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 23.99973967141690400000, 0.00109421184863562390, 24.00000000000000000000);
derivest(poly, 0, 4, 3, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 23.99973863916017100000, 0.00114071321510320180, 24.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 0.99999999999999922000, 0.00000000000000315436, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 0.99999999999999978000, 0.00000000000000103235, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 0.99999999999999978000, 0.00000000000000105052, 1.00000000000000000000);
derivest(poly, 0, 1, 4, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 0.99999999999999989000, 0.00000000000000590073, 1.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 2.00000000000022650000, 0.00000000000003764143, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 2.00000000000001690000, 0.00000000000018161204, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 2.00000000000001690000, 0.00000000000018508286, 2.00000000000000000000);
derivest(poly, 0, 2, 4, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 1.99999999999995160000, 0.00000000000055231492, 2.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 5.99999999999767740000, 0.00000000000516313699, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 5.99999999999797670000, 0.00000000000904077450, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 5.99999999999497740000, 0.00000000002538818152, 6.00000000000000000000);
derivest(poly, 0, 3, 4, DerivestStyle_Backward, 3, &der, &err, &finaldelta); check(der, err, 6.00000000002436180000, 0.00000000036065834537, 6.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Backward, 0, &der, &err, &finaldelta); check(der, err, 24.00000000024323700000, 0.00000000166517992638, 24.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Backward, 1, &der, &err, &finaldelta); check(der, err, 23.99999999948202900000, 0.00000000731445088592, 24.00000000000000000000);
derivest(poly, 0, 4, 4, DerivestStyle_Backward, 2, &der, &err, &finaldelta); check(der, err, 24.00000000662672800000, 0.00000009023646612581, 24.00000000000000000000);
return 0;
}