Commit 2c5ba75
Gerard Gorman
FD weights: 17-digit literals + canonicalized Taylor weights (fixes #2976)
_PRECISION 9 -> 17: 17 significant digits is the minimum that round-trips
an IEEE-754 double, so the C literals parse back to the exact rational
weight (sub-ULP) instead of carrying a ~1.7e-10 relative truncation that
silently floors fp64 cross-implementation checks.
Raising the precision exposed a latent route-inconsistency the 9-digit
rendering had been masking: Taylor weights built through a float x0 shift
(e.g. div(f, shift=.5)) accumulate ~1e-14 relative float error, so the
same stencil built through two routes compared unequal at 17 digits.
Taylor-computed weights are now canonicalized (nearby-rational recovery
within 5e-14 relative, then evalf) so identical stencils are identical
expressions; user-supplied weights are rendered as-is.
Tests: test_derivatives now imports the library _PRECISION instead of a
local copy; 9-digit string expectations regenerated at 17 digits; new
TestCoefficientPrecision regression class (weight-literal fp64 round-trip
+ evaluated-derivative Float atoms round-trip to their exact rationals).1 parent 0aa772b commit 2c5ba75
2 files changed
Lines changed: 94 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 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 | + | |
28 | 58 | | |
29 | 59 | | |
30 | 60 | | |
| |||
168 | 198 | | |
169 | 199 | | |
170 | 200 | | |
| 201 | + | |
171 | 202 | | |
172 | 203 | | |
173 | 204 | | |
| 205 | + | |
174 | 206 | | |
175 | 207 | | |
176 | 208 | | |
177 | 209 | | |
178 | 210 | | |
179 | 211 | | |
| 212 | + | |
180 | 213 | | |
181 | 214 | | |
182 | 215 | | |
183 | 216 | | |
184 | 217 | | |
185 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
186 | 222 | | |
187 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
188 | 227 | | |
189 | 228 | | |
190 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
423 | 424 | | |
424 | 425 | | |
425 | 426 | | |
426 | | - | |
427 | | - | |
| 427 | + | |
| 428 | + | |
428 | 429 | | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
435 | 436 | | |
436 | 437 | | |
437 | 438 | | |
| |||
560 | 561 | | |
561 | 562 | | |
562 | 563 | | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
567 | 568 | | |
568 | 569 | | |
569 | 570 | | |
| |||
1461 | 1462 | | |
1462 | 1463 | | |
1463 | 1464 | | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
0 commit comments