?

Average Accuracy: 89.5% → 95.1%
Time: 25.0s
Precision: binary64
Cost: 2248

?

\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ t_2 := a + b \cdot c\\ t_3 := c \cdot t_2\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(t_2 \cdot i\right)\right)\\ \mathbf{elif}\;t_3 \leq 5 \cdot 10^{+258}:\\ \;\;\;\;2 \cdot \left(t_1 - i \cdot t_3\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t_1 - c \cdot \left(a \cdot i\right)\right)\\ \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ a (* b c))) (t_3 (* c t_2)))
   (if (<= t_3 (- INFINITY))
     (* 2.0 (- (* x y) (* c (* t_2 i))))
     (if (<= t_3 5e+258)
       (* 2.0 (- t_1 (* i t_3)))
       (* 2.0 (- t_1 (* c (* a i))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (x * y) + (z * t);
	double t_2 = a + (b * c);
	double t_3 = c * t_2;
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = 2.0 * ((x * y) - (c * (t_2 * i)));
	} else if (t_3 <= 5e+258) {
		tmp = 2.0 * (t_1 - (i * t_3));
	} else {
		tmp = 2.0 * (t_1 - (c * (a * i)));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (x * y) + (z * t);
	double t_2 = a + (b * c);
	double t_3 = c * t_2;
	double tmp;
	if (t_3 <= -Double.POSITIVE_INFINITY) {
		tmp = 2.0 * ((x * y) - (c * (t_2 * i)));
	} else if (t_3 <= 5e+258) {
		tmp = 2.0 * (t_1 - (i * t_3));
	} else {
		tmp = 2.0 * (t_1 - (c * (a * i)));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
def code(x, y, z, t, a, b, c, i):
	t_1 = (x * y) + (z * t)
	t_2 = a + (b * c)
	t_3 = c * t_2
	tmp = 0
	if t_3 <= -math.inf:
		tmp = 2.0 * ((x * y) - (c * (t_2 * i)))
	elif t_3 <= 5e+258:
		tmp = 2.0 * (t_1 - (i * t_3))
	else:
		tmp = 2.0 * (t_1 - (c * (a * i)))
	return tmp
function code(x, y, z, t, a, b, c, i)
	return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i)))
end
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(x * y) + Float64(z * t))
	t_2 = Float64(a + Float64(b * c))
	t_3 = Float64(c * t_2)
	tmp = 0.0
	if (t_3 <= Float64(-Inf))
		tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(t_2 * i))));
	elseif (t_3 <= 5e+258)
		tmp = Float64(2.0 * Float64(t_1 - Float64(i * t_3)));
	else
		tmp = Float64(2.0 * Float64(t_1 - Float64(c * Float64(a * i))));
	end
	return tmp
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (x * y) + (z * t);
	t_2 = a + (b * c);
	t_3 = c * t_2;
	tmp = 0.0;
	if (t_3 <= -Inf)
		tmp = 2.0 * ((x * y) - (c * (t_2 * i)));
	elseif (t_3 <= 5e+258)
		tmp = 2.0 * (t_1 - (i * t_3));
	else
		tmp = 2.0 * (t_1 - (c * (a * i)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(c * t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(t$95$2 * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e+258], N[(2.0 * N[(t$95$1 - N[(i * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 - N[(c * N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a + b \cdot c\\
t_3 := c \cdot t_2\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(t_2 \cdot i\right)\right)\\

\mathbf{elif}\;t_3 \leq 5 \cdot 10^{+258}:\\
\;\;\;\;2 \cdot \left(t_1 - i \cdot t_3\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 - c \cdot \left(a \cdot i\right)\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original89.5%
Target97.2%
Herbie95.1%
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right) \]

Derivation?

  1. Split input into 3 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -inf.0

    1. Initial program 0.0%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Taylor expanded in z around 0 74.0%

      \[\leadsto 2 \cdot \color{blue}{\left(y \cdot x - c \cdot \left(i \cdot \left(c \cdot b + a\right)\right)\right)} \]

    if -inf.0 < (*.f64 (+.f64 a (*.f64 b c)) c) < 5e258

    1. Initial program 99.5%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]

    if 5e258 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 29.1%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Simplified91.5%

      \[\leadsto \color{blue}{2 \cdot \left(\mathsf{fma}\left(x, y, z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)} \]
      Proof

      [Start]29.1

      \[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]

      associate-*l* [=>]91.5

      \[ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right) \]

      fma-def [=>]91.5

      \[ 2 \cdot \left(\color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)} - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right) \]
    3. Applied egg-rr91.5%

      \[\leadsto 2 \cdot \left(\color{blue}{\left(z \cdot t + x \cdot y\right)} - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right) \]
      Proof

      [Start]91.5

      \[ 2 \cdot \left(\mathsf{fma}\left(x, y, z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right) \]

      fma-udef [=>]91.5

      \[ 2 \cdot \left(\color{blue}{\left(x \cdot y + z \cdot t\right)} - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right) \]

      +-commutative [=>]91.5

      \[ 2 \cdot \left(\color{blue}{\left(z \cdot t + x \cdot y\right)} - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right) \]
    4. Taylor expanded in b around 0 55.9%

      \[\leadsto 2 \cdot \left(\left(z \cdot t + x \cdot y\right) - \color{blue}{c \cdot \left(i \cdot a\right)}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification95.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot \left(a + b \cdot c\right) \leq -\infty:\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\ \mathbf{elif}\;c \cdot \left(a + b \cdot c\right) \leq 5 \cdot 10^{+258}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(a \cdot i\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy82.5%
Cost2000
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ t_2 := 2 \cdot \left(t_1 - c \cdot \left(a \cdot i\right)\right)\\ \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-49}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-180}:\\ \;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-5}:\\ \;\;\;\;2 \cdot \left(t_1 - i \cdot \left(c \cdot \left(b \cdot c\right)\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+84}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t_1 - i \cdot \left(a \cdot c\right)\right)\\ \end{array} \]
Alternative 2
Accuracy62.5%
Cost1499
\[\begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+21} \lor \neg \left(x \leq -3.8 \cdot 10^{-8} \lor \neg \left(x \leq -7.5 \cdot 10^{-216}\right) \land \left(x \leq -3.15 \cdot 10^{-245} \lor \neg \left(x \leq -7.2 \cdot 10^{-281}\right) \land x \leq 5.3 \cdot 10^{-238}\right)\right):\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\ \end{array} \]
Alternative 3
Accuracy72.9%
Cost1490
\[\begin{array}{l} \mathbf{if}\;y \leq -6.6 \cdot 10^{-47} \lor \neg \left(y \leq 2.5 \cdot 10^{-31}\right) \land \left(y \leq 3850000000 \lor \neg \left(y \leq 4.3 \cdot 10^{+38}\right)\right):\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\ \end{array} \]
Alternative 4
Accuracy68.6%
Cost1488
\[\begin{array}{l} t_1 := c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\\ t_2 := 2 \cdot \left(z \cdot t - t_1\right)\\ t_3 := 2 \cdot \left(x \cdot y + z \cdot t\right)\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{+120}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{+63}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -2.7 \cdot 10^{-13}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-269}:\\ \;\;\;\;2 \cdot \left(x \cdot y - t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Accuracy84.0%
Cost1480
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-49}:\\ \;\;\;\;2 \cdot \left(t_1 - c \cdot \left(a \cdot i\right)\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-152}:\\ \;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(t_1 - i \cdot \left(a \cdot c\right)\right)\\ \end{array} \]
Alternative 6
Accuracy86.6%
Cost1224
\[\begin{array}{l} t_1 := c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\\ \mathbf{if}\;c \leq -4.8 \cdot 10^{+55}:\\ \;\;\;\;2 \cdot \left(z \cdot t - t_1\right)\\ \mathbf{elif}\;c \leq 3.6 \cdot 10^{+65}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(a \cdot c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot y - t_1\right)\\ \end{array} \]
Alternative 7
Accuracy84.9%
Cost1224
\[\begin{array}{l} t_1 := x \cdot y + z \cdot t\\ \mathbf{if}\;c \leq -7 \cdot 10^{-127}:\\ \;\;\;\;2 \cdot \left(t_1 - c \cdot \left(c \cdot \left(b \cdot i\right)\right)\right)\\ \mathbf{elif}\;c \leq 3.7 \cdot 10^{+66}:\\ \;\;\;\;2 \cdot \left(t_1 - i \cdot \left(a \cdot c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\ \end{array} \]
Alternative 8
Accuracy97.2%
Cost1216
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right) \]
Alternative 9
Accuracy43.0%
Cost1113
\[\begin{array}{l} t_1 := 2 \cdot \left(z \cdot t\right)\\ t_2 := 2 \cdot \left(x \cdot y\right)\\ \mathbf{if}\;y \leq -2.5 \cdot 10^{-55}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-57}:\\ \;\;\;\;\left(a \cdot \left(c \cdot i\right)\right) \cdot -2\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{+33} \lor \neg \left(y \leq 2.3 \cdot 10^{+67}\right) \land y \leq 6.5 \cdot 10^{+91}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 10
Accuracy43.7%
Cost850
\[\begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{-55} \lor \neg \left(y \leq 5 \cdot 10^{+34}\right) \land \left(y \leq 2.4 \cdot 10^{+72} \lor \neg \left(y \leq 7.5 \cdot 10^{+91}\right)\right):\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(z \cdot t\right)\\ \end{array} \]
Alternative 11
Accuracy64.3%
Cost712
\[\begin{array}{l} \mathbf{if}\;i \leq 3.8 \cdot 10^{+191}:\\ \;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\ \mathbf{elif}\;i \leq 2.7 \cdot 10^{+265}:\\ \;\;\;\;\left(a \cdot \left(c \cdot i\right)\right) \cdot -2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 12
Accuracy33.5%
Cost320
\[2 \cdot \left(z \cdot t\right) \]

Error

Reproduce?

herbie shell --seed 2023135 
(FPCore (x y z t a b c i)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))

  (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))