| Alternative 1 | |
|---|---|
| Accuracy | 99.7% |
| Cost | 61769 |

(FPCore (x1 x2)
:precision binary64
(+
x1
(+
(+
(+
(+
(*
(+
(*
(*
(* 2.0 x1)
(/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)))
(- (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)) 3.0))
(*
(* x1 x1)
(-
(* 4.0 (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)))
6.0)))
(+ (* x1 x1) 1.0))
(*
(* (* 3.0 x1) x1)
(/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))))
(* (* x1 x1) x1))
x1)
(* 3.0 (/ (- (- (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))))))
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (fma x1 (* x1 3.0) (fma 2.0 x2 (- x1)))))
(if (or (<= x1 -5e+153) (not (<= x1 5e+153)))
(+ x1 (fma 3.0 (- (* x1 (* x1 3.0)) x1) x1))
(+
x1
(fma
3.0
(- (* -2.0 x2) x1)
(fma
x1
(* x1 9.0)
(*
(fma x1 x1 1.0)
(+
x1
(+
(* x1 (* x1 -6.0))
(*
(/ t_0 (fma x1 x1 1.0))
(+
(* x1 (+ -6.0 (/ t_0 (/ (fma x1 x1 1.0) 2.0))))
(* (* x1 x1) 4.0))))))))))))double code(double x1, double x2) {
return x1 + (((((((((2.0 * x1) * (((((3.0 * x1) * x1) + (2.0 * x2)) - x1) / ((x1 * x1) + 1.0))) * ((((((3.0 * x1) * x1) + (2.0 * x2)) - x1) / ((x1 * x1) + 1.0)) - 3.0)) + ((x1 * x1) * ((4.0 * (((((3.0 * x1) * x1) + (2.0 * x2)) - x1) / ((x1 * x1) + 1.0))) - 6.0))) * ((x1 * x1) + 1.0)) + (((3.0 * x1) * x1) * (((((3.0 * x1) * x1) + (2.0 * x2)) - x1) / ((x1 * x1) + 1.0)))) + ((x1 * x1) * x1)) + x1) + (3.0 * (((((3.0 * x1) * x1) - (2.0 * x2)) - x1) / ((x1 * x1) + 1.0))));
}
double code(double x1, double x2) {
double t_0 = fma(x1, (x1 * 3.0), fma(2.0, x2, -x1));
double tmp;
if ((x1 <= -5e+153) || !(x1 <= 5e+153)) {
tmp = x1 + fma(3.0, ((x1 * (x1 * 3.0)) - x1), x1);
} else {
tmp = x1 + fma(3.0, ((-2.0 * x2) - x1), fma(x1, (x1 * 9.0), (fma(x1, x1, 1.0) * (x1 + ((x1 * (x1 * -6.0)) + ((t_0 / fma(x1, x1, 1.0)) * ((x1 * (-6.0 + (t_0 / (fma(x1, x1, 1.0) / 2.0)))) + ((x1 * x1) * 4.0))))))));
}
return tmp;
}
function code(x1, x2) return Float64(x1 + Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(2.0 * x1) * Float64(Float64(Float64(Float64(Float64(3.0 * x1) * x1) + Float64(2.0 * x2)) - x1) / Float64(Float64(x1 * x1) + 1.0))) * Float64(Float64(Float64(Float64(Float64(Float64(3.0 * x1) * x1) + Float64(2.0 * x2)) - x1) / Float64(Float64(x1 * x1) + 1.0)) - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(4.0 * Float64(Float64(Float64(Float64(Float64(3.0 * x1) * x1) + Float64(2.0 * x2)) - x1) / Float64(Float64(x1 * x1) + 1.0))) - 6.0))) * Float64(Float64(x1 * x1) + 1.0)) + Float64(Float64(Float64(3.0 * x1) * x1) * Float64(Float64(Float64(Float64(Float64(3.0 * x1) * x1) + Float64(2.0 * x2)) - x1) / Float64(Float64(x1 * x1) + 1.0)))) + Float64(Float64(x1 * x1) * x1)) + x1) + Float64(3.0 * Float64(Float64(Float64(Float64(Float64(3.0 * x1) * x1) - Float64(2.0 * x2)) - x1) / Float64(Float64(x1 * x1) + 1.0))))) end
function code(x1, x2) t_0 = fma(x1, Float64(x1 * 3.0), fma(2.0, x2, Float64(-x1))) tmp = 0.0 if ((x1 <= -5e+153) || !(x1 <= 5e+153)) tmp = Float64(x1 + fma(3.0, Float64(Float64(x1 * Float64(x1 * 3.0)) - x1), x1)); else tmp = Float64(x1 + fma(3.0, Float64(Float64(-2.0 * x2) - x1), fma(x1, Float64(x1 * 9.0), Float64(fma(x1, x1, 1.0) * Float64(x1 + Float64(Float64(x1 * Float64(x1 * -6.0)) + Float64(Float64(t_0 / fma(x1, x1, 1.0)) * Float64(Float64(x1 * Float64(-6.0 + Float64(t_0 / Float64(fma(x1, x1, 1.0) / 2.0)))) + Float64(Float64(x1 * x1) * 4.0))))))))); end return tmp end
code[x1_, x2_] := N[(x1 + N[(N[(N[(N[(N[(N[(N[(N[(N[(2.0 * x1), $MachinePrecision] * N[(N[(N[(N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision] + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision] + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * N[(N[(N[(N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision] + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision] * N[(N[(N[(N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision] + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision] + N[(3.0 * N[(N[(N[(N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision] - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * 3.0), $MachinePrecision] + N[(2.0 * x2 + (-x1)), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x1, -5e+153], N[Not[LessEqual[x1, 5e+153]], $MachinePrecision]], N[(x1 + N[(3.0 * N[(N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(3.0 * N[(N[(-2.0 * x2), $MachinePrecision] - x1), $MachinePrecision] + N[(x1 * N[(x1 * 9.0), $MachinePrecision] + N[(N[(x1 * x1 + 1.0), $MachinePrecision] * N[(x1 + N[(N[(x1 * N[(x1 * -6.0), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x1 * N[(-6.0 + N[(t$95$0 / N[(N[(x1 * x1 + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)\\
\mathbf{if}\;x1 \leq -5 \cdot 10^{+153} \lor \neg \left(x1 \leq 5 \cdot 10^{+153}\right):\\
\;\;\;\;x1 + \mathsf{fma}\left(3, x1 \cdot \left(x1 \cdot 3\right) - x1, x1\right)\\
\mathbf{else}:\\
\;\;\;\;x1 + \mathsf{fma}\left(3, -2 \cdot x2 - x1, \mathsf{fma}\left(x1, x1 \cdot 9, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(x1 \cdot \left(x1 \cdot -6\right) + \frac{t_0}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(x1 \cdot \left(-6 + \frac{t_0}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2}}\right) + \left(x1 \cdot x1\right) \cdot 4\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if x1 < -5.00000000000000018e153 or 5.00000000000000018e153 < x1 Initial program 0.0%
Taylor expanded in x1 around 0 0.0%
Taylor expanded in x1 around 0 66.0%
Simplified66.0%
[Start]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + \left(-2 \cdot x2 + \left(3 - -2 \cdot x2\right) \cdot {x1}^{2}\right)\right)\right)
\] |
|---|---|
+-commutative [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \color{blue}{\left(\left(-2 \cdot x2 + \left(3 - -2 \cdot x2\right) \cdot {x1}^{2}\right) + -1 \cdot x1\right)}\right)
\] |
neg-mul-1 [<=]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\left(-2 \cdot x2 + \left(3 - -2 \cdot x2\right) \cdot {x1}^{2}\right) + \color{blue}{\left(-x1\right)}\right)\right)
\] |
unsub-neg [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \color{blue}{\left(\left(-2 \cdot x2 + \left(3 - -2 \cdot x2\right) \cdot {x1}^{2}\right) - x1\right)}\right)
\] |
+-commutative [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\color{blue}{\left(\left(3 - -2 \cdot x2\right) \cdot {x1}^{2} + -2 \cdot x2\right)} - x1\right)\right)
\] |
*-commutative [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\left(\color{blue}{{x1}^{2} \cdot \left(3 - -2 \cdot x2\right)} + -2 \cdot x2\right) - x1\right)\right)
\] |
fma-def [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\color{blue}{\mathsf{fma}\left({x1}^{2}, 3 - -2 \cdot x2, -2 \cdot x2\right)} - x1\right)\right)
\] |
unpow2 [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\mathsf{fma}\left(\color{blue}{x1 \cdot x1}, 3 - -2 \cdot x2, -2 \cdot x2\right) - x1\right)\right)
\] |
cancel-sign-sub-inv [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, \color{blue}{3 + \left(--2\right) \cdot x2}, -2 \cdot x2\right) - x1\right)\right)
\] |
metadata-eval [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, 3 + \color{blue}{2} \cdot x2, -2 \cdot x2\right) - x1\right)\right)
\] |
+-commutative [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, \color{blue}{2 \cdot x2 + 3}, -2 \cdot x2\right) - x1\right)\right)
\] |
*-commutative [=>]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, 2 \cdot x2 + 3, \color{blue}{x2 \cdot -2}\right) - x1\right)\right)
\] |
Applied egg-rr66.0%
[Start]66.0% | \[ x1 + \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, 2 \cdot x2 + 3, x2 \cdot -2\right) - x1\right)\right)
\] |
|---|---|
*-un-lft-identity [=>]66.0% | \[ x1 + \color{blue}{1 \cdot \left(\left(4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right) + x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, 2 \cdot x2 + 3, x2 \cdot -2\right) - x1\right)\right)}
\] |
fma-def [=>]66.0% | \[ x1 + 1 \cdot \left(\color{blue}{\mathsf{fma}\left(4, x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right), x1\right)} + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, 2 \cdot x2 + 3, x2 \cdot -2\right) - x1\right)\right)
\] |
fma-neg [=>]66.0% | \[ x1 + 1 \cdot \left(\mathsf{fma}\left(4, x2 \cdot \left(x1 \cdot \color{blue}{\mathsf{fma}\left(2, x2, -3\right)}\right), x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, 2 \cdot x2 + 3, x2 \cdot -2\right) - x1\right)\right)
\] |
metadata-eval [=>]66.0% | \[ x1 + 1 \cdot \left(\mathsf{fma}\left(4, x2 \cdot \left(x1 \cdot \mathsf{fma}\left(2, x2, \color{blue}{-3}\right)\right), x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, 2 \cdot x2 + 3, x2 \cdot -2\right) - x1\right)\right)
\] |
fma-def [=>]66.0% | \[ x1 + 1 \cdot \left(\mathsf{fma}\left(4, x2 \cdot \left(x1 \cdot \mathsf{fma}\left(2, x2, -3\right)\right), x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, \color{blue}{\mathsf{fma}\left(2, x2, 3\right)}, x2 \cdot -2\right) - x1\right)\right)
\] |
Simplified66.0%
[Start]66.0% | \[ x1 + 1 \cdot \left(\mathsf{fma}\left(4, x2 \cdot \left(x1 \cdot \mathsf{fma}\left(2, x2, -3\right)\right), x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, \mathsf{fma}\left(2, x2, 3\right), x2 \cdot -2\right) - x1\right)\right)
\] |
|---|---|
*-lft-identity [=>]66.0% | \[ x1 + \color{blue}{\left(\mathsf{fma}\left(4, x2 \cdot \left(x1 \cdot \mathsf{fma}\left(2, x2, -3\right)\right), x1\right) + 3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, \mathsf{fma}\left(2, x2, 3\right), x2 \cdot -2\right) - x1\right)\right)}
\] |
+-commutative [=>]66.0% | \[ x1 + \color{blue}{\left(3 \cdot \left(\mathsf{fma}\left(x1 \cdot x1, \mathsf{fma}\left(2, x2, 3\right), x2 \cdot -2\right) - x1\right) + \mathsf{fma}\left(4, x2 \cdot \left(x1 \cdot \mathsf{fma}\left(2, x2, -3\right)\right), x1\right)\right)}
\] |
fma-def [=>]66.0% | \[ x1 + \color{blue}{\mathsf{fma}\left(3, \mathsf{fma}\left(x1 \cdot x1, \mathsf{fma}\left(2, x2, 3\right), x2 \cdot -2\right) - x1, \mathsf{fma}\left(4, x2 \cdot \left(x1 \cdot \mathsf{fma}\left(2, x2, -3\right)\right), x1\right)\right)}
\] |
fma-udef [=>]66.0% | \[ x1 + \mathsf{fma}\left(3, \mathsf{fma}\left(x1 \cdot x1, \mathsf{fma}\left(2, x2, 3\right), x2 \cdot -2\right) - x1, \color{blue}{4 \cdot \left(x2 \cdot \left(x1 \cdot \mathsf{fma}\left(2, x2, -3\right)\right)\right) + x1}\right)
\] |
associate-*r* [=>]66.0% | \[ x1 + \mathsf{fma}\left(3, \mathsf{fma}\left(x1 \cdot x1, \mathsf{fma}\left(2, x2, 3\right), x2 \cdot -2\right) - x1, \color{blue}{\left(4 \cdot x2\right) \cdot \left(x1 \cdot \mathsf{fma}\left(2, x2, -3\right)\right)} + x1\right)
\] |
fma-def [=>]66.0% | \[ x1 + \mathsf{fma}\left(3, \mathsf{fma}\left(x1 \cdot x1, \mathsf{fma}\left(2, x2, 3\right), x2 \cdot -2\right) - x1, \color{blue}{\mathsf{fma}\left(4 \cdot x2, x1 \cdot \mathsf{fma}\left(2, x2, -3\right), x1\right)}\right)
\] |
*-commutative [=>]66.0% | \[ x1 + \mathsf{fma}\left(3, \mathsf{fma}\left(x1 \cdot x1, \mathsf{fma}\left(2, x2, 3\right), x2 \cdot -2\right) - x1, \mathsf{fma}\left(\color{blue}{x2 \cdot 4}, x1 \cdot \mathsf{fma}\left(2, x2, -3\right), x1\right)\right)
\] |
Taylor expanded in x2 around 0 100.0%
Simplified100.0%
[Start]100.0% | \[ x1 + \left(x1 + 3 \cdot \left(3 \cdot {x1}^{2} - x1\right)\right)
\] |
|---|---|
+-commutative [=>]100.0% | \[ x1 + \color{blue}{\left(3 \cdot \left(3 \cdot {x1}^{2} - x1\right) + x1\right)}
\] |
fma-def [=>]100.0% | \[ x1 + \color{blue}{\mathsf{fma}\left(3, 3 \cdot {x1}^{2} - x1, x1\right)}
\] |
*-commutative [=>]100.0% | \[ x1 + \mathsf{fma}\left(3, \color{blue}{{x1}^{2} \cdot 3} - x1, x1\right)
\] |
unpow2 [=>]100.0% | \[ x1 + \mathsf{fma}\left(3, \color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1, x1\right)
\] |
associate-*l* [=>]100.0% | \[ x1 + \mathsf{fma}\left(3, \color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1, x1\right)
\] |
if -5.00000000000000018e153 < x1 < 5.00000000000000018e153Initial program 89.5%
Simplified99.7%
[Start]89.5% | \[ x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)
\] |
|---|---|
+-commutative [=>]89.5% | \[ x1 + \color{blue}{\left(3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right)\right)}
\] |
Taylor expanded in x1 around inf 98.4%
Taylor expanded in x1 around 0 99.7%
Simplified99.7%
[Start]99.7% | \[ x1 + \mathsf{fma}\left(3, -1 \cdot x1 + -2 \cdot x2, \mathsf{fma}\left(x1, x1 \cdot 9, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(x1 \cdot \left(x1 \cdot -6\right) + \frac{\mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(x1 \cdot \left(-6 + \frac{\mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2}}\right) + \left(x1 \cdot x1\right) \cdot 4\right)\right)\right)\right)\right)
\] |
|---|---|
+-commutative [=>]99.7% | \[ x1 + \mathsf{fma}\left(3, \color{blue}{-2 \cdot x2 + -1 \cdot x1}, \mathsf{fma}\left(x1, x1 \cdot 9, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(x1 \cdot \left(x1 \cdot -6\right) + \frac{\mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(x1 \cdot \left(-6 + \frac{\mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2}}\right) + \left(x1 \cdot x1\right) \cdot 4\right)\right)\right)\right)\right)
\] |
neg-mul-1 [<=]99.7% | \[ x1 + \mathsf{fma}\left(3, -2 \cdot x2 + \color{blue}{\left(-x1\right)}, \mathsf{fma}\left(x1, x1 \cdot 9, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(x1 \cdot \left(x1 \cdot -6\right) + \frac{\mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(x1 \cdot \left(-6 + \frac{\mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2}}\right) + \left(x1 \cdot x1\right) \cdot 4\right)\right)\right)\right)\right)
\] |
unsub-neg [=>]99.7% | \[ x1 + \mathsf{fma}\left(3, \color{blue}{-2 \cdot x2 - x1}, \mathsf{fma}\left(x1, x1 \cdot 9, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(x1 \cdot \left(x1 \cdot -6\right) + \frac{\mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(x1 \cdot \left(-6 + \frac{\mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2}}\right) + \left(x1 \cdot x1\right) \cdot 4\right)\right)\right)\right)\right)
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.7% |
| Cost | 61769 |
| Alternative 2 | |
|---|---|
| Accuracy | 98.0% |
| Cost | 8524 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 8524 |
| Alternative 4 | |
|---|---|
| Accuracy | 97.1% |
| Cost | 8072 |
| Alternative 5 | |
|---|---|
| Accuracy | 96.8% |
| Cost | 7816 |
| Alternative 6 | |
|---|---|
| Accuracy | 94.8% |
| Cost | 7625 |
| Alternative 7 | |
|---|---|
| Accuracy | 85.8% |
| Cost | 7369 |
| Alternative 8 | |
|---|---|
| Accuracy | 87.5% |
| Cost | 7369 |
| Alternative 9 | |
|---|---|
| Accuracy | 89.1% |
| Cost | 7369 |
| Alternative 10 | |
|---|---|
| Accuracy | 94.8% |
| Cost | 7369 |
| Alternative 11 | |
|---|---|
| Accuracy | 75.3% |
| Cost | 5832 |
| Alternative 12 | |
|---|---|
| Accuracy | 74.3% |
| Cost | 5448 |
| Alternative 13 | |
|---|---|
| Accuracy | 75.0% |
| Cost | 5200 |
| Alternative 14 | |
|---|---|
| Accuracy | 63.0% |
| Cost | 1604 |
| Alternative 15 | |
|---|---|
| Accuracy | 63.0% |
| Cost | 1604 |
| Alternative 16 | |
|---|---|
| Accuracy | 42.6% |
| Cost | 1352 |
| Alternative 17 | |
|---|---|
| Accuracy | 57.5% |
| Cost | 1348 |
| Alternative 18 | |
|---|---|
| Accuracy | 46.3% |
| Cost | 1220 |
| Alternative 19 | |
|---|---|
| Accuracy | 52.0% |
| Cost | 1220 |
| Alternative 20 | |
|---|---|
| Accuracy | 42.5% |
| Cost | 973 |
| Alternative 21 | |
|---|---|
| Accuracy | 37.7% |
| Cost | 841 |
| Alternative 22 | |
|---|---|
| Accuracy | 26.5% |
| Cost | 320 |
| Alternative 23 | |
|---|---|
| Accuracy | 3.3% |
| Cost | 192 |
herbie shell --seed 2023167
(FPCore (x1 x2)
:name "Rosa's FloatVsDoubleBenchmark"
:precision binary64
(+ x1 (+ (+ (+ (+ (* (+ (* (* (* 2.0 x1) (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))) (- (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)) 3.0)) (* (* x1 x1) (- (* 4.0 (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))) 6.0))) (+ (* x1 x1) 1.0)) (* (* (* 3.0 x1) x1) (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)))) (* (* x1 x1) x1)) x1) (* 3.0 (/ (- (- (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))))))