| Alternative 1 | |
|---|---|
| Accuracy | 74.7% |
| Cost | 521 |
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-90} \lor \neg \left(z \leq 9.2 \cdot 10^{+70}\right):\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (+ (- (- (* x y) (* y z)) (* y y)) (* y y)))
(FPCore (x y z) :precision binary64 (fma y x (* y (- z))))
double code(double x, double y, double z) {
return (((x * y) - (y * z)) - (y * y)) + (y * y);
}
double code(double x, double y, double z) {
return fma(y, x, (y * -z));
}
function code(x, y, z) return Float64(Float64(Float64(Float64(x * y) - Float64(y * z)) - Float64(y * y)) + Float64(y * y)) end
function code(x, y, z) return fma(y, x, Float64(y * Float64(-z))) end
code[x_, y_, z_] := N[(N[(N[(N[(x * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(y * x + N[(y * (-z)), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y - y \cdot z\right) - y \cdot y\right) + y \cdot y
\mathsf{fma}\left(y, x, y \cdot \left(-z\right)\right)
| Original | 72.2% |
|---|---|
| Target | 100.0% |
| Herbie | 100.0% |
Initial program 72.2%
Applied egg-rr100.0%
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 74.7% |
| Cost | 521 |
| Alternative 2 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 448 |
| Alternative 3 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 320 |
| Alternative 4 | |
|---|---|
| Accuracy | 53.4% |
| Cost | 192 |
herbie shell --seed 2023129
(FPCore (x y z)
:name "Linear.Quaternion:$c/ from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(* (- x z) y)
(+ (- (- (* x y) (* y z)) (* y y)) (* y y)))