Commit f3c9deb
committed
fix: use precision-aware default tolerance in f_approx_equal
Single precision (wp=real(4)) has ~7 decimal digits of precision, so
a default tolerance of 1e-10 is below machine epsilon (~1.2e-7) and
f_approx_equal would almost never return true. Use 1e-6 for single
precision builds and keep 1e-10 for double precision.
The wp == single_precision comparison uses integer parameter constants
that the compiler resolves at compile time, so there is no runtime cost.1 parent 3b201e3 commit f3c9deb
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
61 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
62 | 71 | | |
63 | 72 | | |
64 | 73 | | |
| |||
0 commit comments