?

Average Accuracy: 94.9% → 99.0%
Time: 17.1s
Precision: binary64
Cost: 1220

?

\[ \begin{array}{c}[y, z, t] = \mathsf{sort}([y, z, t])\\ [a, b] = \mathsf{sort}([a, b])\\ \end{array} \]
\[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
\[\begin{array}{l} t_1 := b \cdot \left(a \cdot 27\right)\\ \mathbf{if}\;t \leq 5 \cdot 10^{+28}:\\ \;\;\;\;\left(x \cdot 2 + \left(z \cdot \left(t \cdot y\right)\right) \cdot -9\right) + t_1\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 + t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\right) + t_1\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (* a 27.0))))
   (if (<= t 5e+28)
     (+ (+ (* x 2.0) (* (* z (* t y)) -9.0)) t_1)
     (+ (+ (* x 2.0) (* t (* z (* y -9.0)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a * 27.0);
	double tmp;
	if (t <= 5e+28) {
		tmp = ((x * 2.0) + ((z * (t * y)) * -9.0)) + t_1;
	} else {
		tmp = ((x * 2.0) + (t * (z * (y * -9.0)))) + t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = b * (a * 27.0d0)
    if (t <= 5d+28) then
        tmp = ((x * 2.0d0) + ((z * (t * y)) * (-9.0d0))) + t_1
    else
        tmp = ((x * 2.0d0) + (t * (z * (y * (-9.0d0))))) + t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a * 27.0);
	double tmp;
	if (t <= 5e+28) {
		tmp = ((x * 2.0) + ((z * (t * y)) * -9.0)) + t_1;
	} else {
		tmp = ((x * 2.0) + (t * (z * (y * -9.0)))) + t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
def code(x, y, z, t, a, b):
	t_1 = b * (a * 27.0)
	tmp = 0
	if t <= 5e+28:
		tmp = ((x * 2.0) + ((z * (t * y)) * -9.0)) + t_1
	else:
		tmp = ((x * 2.0) + (t * (z * (y * -9.0)))) + t_1
	return tmp
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b))
end
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(a * 27.0))
	tmp = 0.0
	if (t <= 5e+28)
		tmp = Float64(Float64(Float64(x * 2.0) + Float64(Float64(z * Float64(t * y)) * -9.0)) + t_1);
	else
		tmp = Float64(Float64(Float64(x * 2.0) + Float64(t * Float64(z * Float64(y * -9.0)))) + t_1);
	end
	return tmp
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (a * 27.0);
	tmp = 0.0;
	if (t <= 5e+28)
		tmp = ((x * 2.0) + ((z * (t * y)) * -9.0)) + t_1;
	else
		tmp = ((x * 2.0) + (t * (z * (y * -9.0)))) + t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 5e+28], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(N[(z * N[(t * y), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;t \leq 5 \cdot 10^{+28}:\\
\;\;\;\;\left(x \cdot 2 + \left(z \cdot \left(t \cdot y\right)\right) \cdot -9\right) + t_1\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 + t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\right) + t_1\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original94.9%
Target94.2%
Herbie99.0%
\[\begin{array}{l} \mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if t < 4.99999999999999957e28

    1. Initial program 91.8%

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

      \[\leadsto \left(x \cdot 2 - \color{blue}{9 \cdot \left(y \cdot \left(t \cdot z\right)\right)}\right) + \left(a \cdot 27\right) \cdot b \]
    3. Simplified99.6%

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

      [Start]98.9

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

      associate-*r* [=>]99.6

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

      *-commutative [=>]99.6

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

    if 4.99999999999999957e28 < t

    1. Initial program 98.3%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.0%

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

Alternatives

Alternative 1
Accuracy90.7%
Cost1353
\[\begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{-122} \lor \neg \left(z \leq 4.4 \cdot 10^{-219}\right):\\ \;\;\;\;\left(x \cdot 2 + \left(z \cdot \left(t \cdot y\right)\right) \cdot -9\right) + b \cdot \left(a \cdot 27\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \end{array} \]
Alternative 2
Accuracy90.6%
Cost1352
\[\begin{array}{l} t_1 := b \cdot \left(a \cdot 27\right)\\ \mathbf{if}\;z \leq -4.75 \cdot 10^{-122}:\\ \;\;\;\;\left(x \cdot 2 + z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\right) + t_1\\ \mathbf{elif}\;z \leq 10^{-220}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 + \left(z \cdot \left(t \cdot y\right)\right) \cdot -9\right) + t_1\\ \end{array} \]
Alternative 3
Accuracy54.4%
Cost1244
\[\begin{array}{l} t_1 := b \cdot \left(a \cdot 27\right)\\ t_2 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{if}\;x \leq -1100000000:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-113}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-216}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-273}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-64}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 4
Accuracy52.2%
Cost1244
\[\begin{array}{l} t_1 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ t_2 := b \cdot \left(a \cdot 27\right)\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+123}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-114}:\\ \;\;\;\;y \cdot \left(\left(t \cdot z\right) \cdot -9\right)\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-214}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-279}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-62}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+42}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 5
Accuracy52.2%
Cost1244
\[\begin{array}{l} t_1 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ t_2 := b \cdot \left(a \cdot 27\right)\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+123}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{-114}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq -6.7 \cdot 10^{-214}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-278}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-63}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+44}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 6
Accuracy52.1%
Cost1244
\[\begin{array}{l} t_1 := b \cdot \left(a \cdot 27\right)\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+123}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{-114}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-216}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-276}:\\ \;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-62}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-22}:\\ \;\;\;\;\left(t \cdot z\right) \cdot \left(y \cdot -9\right)\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+42}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 7
Accuracy52.1%
Cost1244
\[\begin{array}{l} t_1 := b \cdot \left(a \cdot 27\right)\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+123}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-113}:\\ \;\;\;\;\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-275}:\\ \;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-63}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{-24}:\\ \;\;\;\;\left(t \cdot z\right) \cdot \left(y \cdot -9\right)\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+43}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 8
Accuracy72.6%
Cost1236
\[\begin{array}{l} t_1 := x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;z \leq 1.42 \cdot 10^{-49}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.1 \cdot 10^{-33}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-9}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1050000000000:\\ \;\;\;\;\left(y \cdot \left(t \cdot z\right)\right) \cdot -9\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+57}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\left(t \cdot y\right) \cdot -9\right)\\ \end{array} \]
Alternative 9
Accuracy98.9%
Cost1220
\[\begin{array}{l} \mathbf{if}\;z \leq 10^{-32}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 + \left(t \cdot z\right) \cdot \left(y \cdot -9\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 + \left(z \cdot \left(t \cdot y\right)\right) \cdot -9\right) + b \cdot \left(a \cdot 27\right)\\ \end{array} \]
Alternative 10
Accuracy99.0%
Cost1220
\[\begin{array}{l} t_1 := b \cdot \left(a \cdot 27\right)\\ \mathbf{if}\;t \leq 4 \cdot 10^{-13}:\\ \;\;\;\;\left(x \cdot 2 + \left(z \cdot \left(t \cdot y\right)\right) \cdot -9\right) + t_1\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 + t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\right) + t_1\\ \end{array} \]
Alternative 11
Accuracy78.2%
Cost1100
\[\begin{array}{l} t_1 := x \cdot 2 + \left(t \cdot z\right) \cdot \left(y \cdot -9\right)\\ \mathbf{if}\;z \leq -2.15 \cdot 10^{-69}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-59}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\left(t \cdot y\right) \cdot -9\right)\\ \end{array} \]
Alternative 12
Accuracy78.3%
Cost1100
\[\begin{array}{l} t_1 := x \cdot 2 + \left(y \cdot \left(t \cdot z\right)\right) \cdot -9\\ \mathbf{if}\;z \leq -2.3 \cdot 10^{-73}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-58}:\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+72}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\left(t \cdot y\right) \cdot -9\right)\\ \end{array} \]
Alternative 13
Accuracy80.7%
Cost1096
\[\begin{array}{l} t_1 := 27 \cdot \left(a \cdot b\right)\\ t_2 := y \cdot \left(t \cdot z\right)\\ \mathbf{if}\;x \leq -3.8 \cdot 10^{-47}:\\ \;\;\;\;x \cdot 2 + t_2 \cdot -9\\ \mathbf{elif}\;x \leq 210:\\ \;\;\;\;t_1 - 9 \cdot t_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 + t_1\\ \end{array} \]
Alternative 14
Accuracy55.9%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-48}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{+42}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 15
Accuracy55.8%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{-47}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+42}:\\ \;\;\;\;b \cdot \left(a \cdot 27\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 16
Accuracy41.3%
Cost192
\[x \cdot 2 \]

Error

Reproduce?

herbie shell --seed 2023137 
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))

  (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))