Average Error: 3.5 → 0.7
Time: 9.6s
Precision: binary64
Cost: 2242
\[\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} \mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq -5.868557331434209 \cdot 10^{+160}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;\left(y \cdot 9\right) \cdot z \leq 4.8483994624021507 \cdot 10^{+179}:\\ \;\;\;\;\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(a \cdot 27\right) \cdot b + \left(x \cdot 2 + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)\\ \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}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq -5.868557331434209 \cdot 10^{+160}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\

\mathbf{elif}\;\left(y \cdot 9\right) \cdot z \leq 4.8483994624021507 \cdot 10^{+179}:\\
\;\;\;\;\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(a \cdot 27\right) \cdot b + \left(x \cdot 2 + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)\\

\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
 (if (<= (* (* y 9.0) z) -5.868557331434209e+160)
   (+ (* (* a 27.0) b) (- (* x 2.0) (* (* y 9.0) (* z t))))
   (if (<= (* (* y 9.0) z) 4.8483994624021507e+179)
     (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b)))
     (+ (* (* a 27.0) b) (+ (* x 2.0) (* y (* z (* t -9.0))))))))
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 tmp;
	if (((y * 9.0) * z) <= -5.868557331434209e+160) {
		tmp = ((a * 27.0) * b) + ((x * 2.0) - ((y * 9.0) * (z * t)));
	} else if (((y * 9.0) * z) <= 4.8483994624021507e+179) {
		tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
	} else {
		tmp = ((a * 27.0) * b) + ((x * 2.0) + (y * (z * (t * -9.0))));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.5
Target2.7
Herbie0.7
\[\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}\]

Alternatives

Alternative 1
Error1.1
Cost3778
\[\begin{array}{l} \mathbf{if}\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \leq -1.1463627336635536 \cdot 10^{+307}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \leq 2.6573806839465113 \cdot 10^{+273}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)\\ \end{array}\]
Alternative 2
Error4.3
Cost1986
\[\begin{array}{l} \mathbf{if}\;y \cdot 9 \leq -7.931841731608607 \cdot 10^{-140}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)\\ \mathbf{elif}\;y \cdot 9 \leq 1.0389592269383649 \cdot 10^{-153}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x + x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\ \end{array}\]
Alternative 3
Error4.3
Cost1672
\[\begin{array}{l} \mathbf{if}\;y \cdot 9 \leq -7.931841731608607 \cdot 10^{-140} \lor \neg \left(y \cdot 9 \leq 1.0389592269383649 \cdot 10^{-153}\right):\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x + x\right)\\ \end{array}\]
Alternative 4
Error11.7
Cost1160
\[\begin{array}{l} \mathbf{if}\;x \leq -3.4851078552318456 \cdot 10^{-41} \lor \neg \left(x \leq 3.5090739385761904 \cdot 10^{-30}\right):\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x + x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\ \end{array}\]
Alternative 5
Error11.7
Cost1160
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5096281157144727 \cdot 10^{-39} \lor \neg \left(x \leq 5.855129180921564 \cdot 10^{-30}\right):\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x + x\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \end{array}\]
Alternative 6
Error18.2
Cost576
\[a \cdot \left(27 \cdot b\right) + \left(x + x\right)\]
Alternative 7
Error61.9
Cost64
\[-1\]
Alternative 8
Error61.9
Cost64
\[1\]

Error

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 9) z) < -5.868557331434209e160

    1. Initial program 18.6

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-*l*_binary64_215021.8

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

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

    if -5.868557331434209e160 < (*.f64 (*.f64 y 9) z) < 4.84839946240215068e179

    1. Initial program 0.5

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-*l*_binary64_215020.5

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

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

    if 4.84839946240215068e179 < (*.f64 (*.f64 y 9) z)

    1. Initial program 21.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. Using strategy rm
    3. Applied associate-*l*_binary64_2150221.6

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    4. Using strategy rm
    5. Applied sub-neg_binary64_2155421.6

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

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

      \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq -5.868557331434209 \cdot 10^{+160}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;\left(y \cdot 9\right) \cdot z \leq 4.8483994624021507 \cdot 10^{+179}:\\ \;\;\;\;\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(a \cdot 27\right) \cdot b + \left(x \cdot 2 + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2021044 
(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)))