| Alternative 1 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 6848 |
\[1 - x \cdot \mathsf{fma}\left(x, 0.12, 0.253\right)
\]

(FPCore (x) :precision binary64 (- 1.0 (* x (+ 0.253 (* x 0.12)))))
(FPCore (x) :precision binary64 (- 1.0 (* x (fma x 0.12 0.253))))
double code(double x) {
return 1.0 - (x * (0.253 + (x * 0.12)));
}
double code(double x) {
return 1.0 - (x * fma(x, 0.12, 0.253));
}
function code(x) return Float64(1.0 - Float64(x * Float64(0.253 + Float64(x * 0.12)))) end
function code(x) return Float64(1.0 - Float64(x * fma(x, 0.12, 0.253))) end
code[x_] := N[(1.0 - N[(x * N[(0.253 + N[(x * 0.12), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(1.0 - N[(x * N[(x * 0.12 + 0.253), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - x \cdot \left(0.253 + x \cdot 0.12\right)
1 - x \cdot \mathsf{fma}\left(x, 0.12, 0.253\right)
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Initial program 99.9%
Simplified99.9%
[Start]99.9% | \[ 1 - x \cdot \left(0.253 + x \cdot 0.12\right)
\] |
|---|---|
+-commutative [=>]99.9% | \[ 1 - x \cdot \color{blue}{\left(x \cdot 0.12 + 0.253\right)}
\] |
fma-def [=>]99.9% | \[ 1 - x \cdot \color{blue}{\mathsf{fma}\left(x, 0.12, 0.253\right)}
\] |
Final simplification99.9%
| Alternative 1 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 6848 |
| Alternative 2 | |
|---|---|
| Accuracy | 98.9% |
| Cost | 713 |
| Alternative 3 | |
|---|---|
| Accuracy | 97.9% |
| Cost | 585 |
| Alternative 4 | |
|---|---|
| Accuracy | 97.9% |
| Cost | 584 |
| Alternative 5 | |
|---|---|
| Accuracy | 98.5% |
| Cost | 584 |
| Alternative 6 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 576 |
| Alternative 7 | |
|---|---|
| Accuracy | 49.6% |
| Cost | 64 |
herbie shell --seed 2023272
(FPCore (x)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, A"
:precision binary64
(- 1.0 (* x (+ 0.253 (* x 0.12)))))