| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6848 |
\[\mathsf{fma}\left(y - z, t - x, x\right)
\]
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
(FPCore (x y z t) :precision binary64 (fma (+ (- z y) 1.0) x (* t (- y z))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
double code(double x, double y, double z, double t) {
return fma(((z - y) + 1.0), x, (t * (y - z)));
}
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function code(x, y, z, t) return fma(Float64(Float64(z - y) + 1.0), x, Float64(t * Float64(y - z))) end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision] * x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(y - z\right) \cdot \left(t - x\right)
\mathsf{fma}\left(\left(z - y\right) + 1, x, t \cdot \left(y - z\right)\right)
| Original | 100.0% |
|---|---|
| Target | 100.0% |
| Herbie | 100.0% |
Initial program 100.0%
Applied egg-rr100.0%
[Start]100.0 | \[ x + \left(y - z\right) \cdot \left(t - x\right)
\] |
|---|---|
*-commutative [=>]100.0 | \[ x + \color{blue}{\left(t - x\right) \cdot \left(y - z\right)}
\] |
sub-neg [=>]100.0 | \[ x + \left(t - x\right) \cdot \color{blue}{\left(y + \left(-z\right)\right)}
\] |
distribute-lft-in [=>]100.0 | \[ x + \color{blue}{\left(\left(t - x\right) \cdot y + \left(t - x\right) \cdot \left(-z\right)\right)}
\] |
Taylor expanded in t around -inf 100.0%
Simplified100.0%
[Start]100.0 | \[ z \cdot x + \left(-1 \cdot \left(y \cdot x\right) + \left(x + -1 \cdot \left(t \cdot \left(z + -1 \cdot y\right)\right)\right)\right)
\] |
|---|---|
associate-+r+ [=>]100.0 | \[ \color{blue}{\left(z \cdot x + -1 \cdot \left(y \cdot x\right)\right) + \left(x + -1 \cdot \left(t \cdot \left(z + -1 \cdot y\right)\right)\right)}
\] |
associate-*r* [=>]100.0 | \[ \left(z \cdot x + \color{blue}{\left(-1 \cdot y\right) \cdot x}\right) + \left(x + -1 \cdot \left(t \cdot \left(z + -1 \cdot y\right)\right)\right)
\] |
distribute-rgt-in [<=]100.0 | \[ \color{blue}{x \cdot \left(z + -1 \cdot y\right)} + \left(x + -1 \cdot \left(t \cdot \left(z + -1 \cdot y\right)\right)\right)
\] |
mul-1-neg [=>]100.0 | \[ x \cdot \left(z + \color{blue}{\left(-y\right)}\right) + \left(x + -1 \cdot \left(t \cdot \left(z + -1 \cdot y\right)\right)\right)
\] |
sub-neg [<=]100.0 | \[ x \cdot \color{blue}{\left(z - y\right)} + \left(x + -1 \cdot \left(t \cdot \left(z + -1 \cdot y\right)\right)\right)
\] |
mul-1-neg [=>]100.0 | \[ x \cdot \left(z - y\right) + \left(x + \color{blue}{\left(-t \cdot \left(z + -1 \cdot y\right)\right)}\right)
\] |
unsub-neg [=>]100.0 | \[ x \cdot \left(z - y\right) + \color{blue}{\left(x - t \cdot \left(z + -1 \cdot y\right)\right)}
\] |
mul-1-neg [=>]100.0 | \[ x \cdot \left(z - y\right) + \left(x - t \cdot \left(z + \color{blue}{\left(-y\right)}\right)\right)
\] |
sub-neg [<=]100.0 | \[ x \cdot \left(z - y\right) + \left(x - t \cdot \color{blue}{\left(z - y\right)}\right)
\] |
Applied egg-rr100.0%
[Start]100.0 | \[ x \cdot \left(z - y\right) + \left(x - t \cdot \left(z - y\right)\right)
\] |
|---|---|
associate-+r- [=>]100.0 | \[ \color{blue}{\left(x \cdot \left(z - y\right) + x\right) - t \cdot \left(z - y\right)}
\] |
*-commutative [=>]100.0 | \[ \left(\color{blue}{\left(z - y\right) \cdot x} + x\right) - t \cdot \left(z - y\right)
\] |
distribute-lft1-in [=>]100.0 | \[ \color{blue}{\left(\left(z - y\right) + 1\right) \cdot x} - t \cdot \left(z - y\right)
\] |
fma-neg [=>]100.0 | \[ \color{blue}{\mathsf{fma}\left(\left(z - y\right) + 1, x, -t \cdot \left(z - y\right)\right)}
\] |
*-commutative [=>]100.0 | \[ \mathsf{fma}\left(\left(z - y\right) + 1, x, -\color{blue}{\left(z - y\right) \cdot t}\right)
\] |
distribute-rgt-neg-in [=>]100.0 | \[ \mathsf{fma}\left(\left(z - y\right) + 1, x, \color{blue}{\left(z - y\right) \cdot \left(-t\right)}\right)
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6848 |
| Alternative 2 | |
|---|---|
| Accuracy | 46.8% |
| Cost | 1905 |
| Alternative 3 | |
|---|---|
| Accuracy | 53.3% |
| Cost | 1376 |
| Alternative 4 | |
|---|---|
| Accuracy | 68.0% |
| Cost | 1376 |
| Alternative 5 | |
|---|---|
| Accuracy | 79.7% |
| Cost | 1240 |
| Alternative 6 | |
|---|---|
| Accuracy | 65.8% |
| Cost | 1112 |
| Alternative 7 | |
|---|---|
| Accuracy | 61.6% |
| Cost | 980 |
| Alternative 8 | |
|---|---|
| Accuracy | 80.2% |
| Cost | 976 |
| Alternative 9 | |
|---|---|
| Accuracy | 37.9% |
| Cost | 916 |
| Alternative 10 | |
|---|---|
| Accuracy | 62.4% |
| Cost | 850 |
| Alternative 11 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 832 |
| Alternative 12 | |
|---|---|
| Accuracy | 36.8% |
| Cost | 784 |
| Alternative 13 | |
|---|---|
| Accuracy | 83.4% |
| Cost | 713 |
| Alternative 14 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 576 |
| Alternative 15 | |
|---|---|
| Accuracy | 40.3% |
| Cost | 456 |
| Alternative 16 | |
|---|---|
| Accuracy | 27.0% |
| Cost | 64 |
herbie shell --seed 2023147
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:herbie-target
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))