?

Average Error: 3.0 → 0.8
Time: 18.2s
Precision: binary64
Cost: 13892

?

\[ \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} \mathbf{if}\;y \cdot 9 \leq -5 \cdot 10^{+57}:\\ \;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(y, t \cdot \left(z \cdot -9\right), \left(a \cdot 27\right) \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, x, \mathsf{fma}\left(a, 27 \cdot b, z \cdot \left(t \cdot \left(y \cdot -9\right)\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) -5e+57)
   (fma x 2.0 (fma y (* t (* z -9.0)) (* (* a 27.0) b)))
   (fma 2.0 x (fma a (* 27.0 b) (* z (* t (* y -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) <= -5e+57) {
		tmp = fma(x, 2.0, fma(y, (t * (z * -9.0)), ((a * 27.0) * b)));
	} else {
		tmp = fma(2.0, x, fma(a, (27.0 * b), (z * (t * (y * -9.0)))));
	}
	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)
	tmp = 0.0
	if (Float64(y * 9.0) <= -5e+57)
		tmp = fma(x, 2.0, fma(y, Float64(t * Float64(z * -9.0)), Float64(Float64(a * 27.0) * b)));
	else
		tmp = fma(2.0, x, fma(a, Float64(27.0 * b), Float64(z * Float64(t * Float64(y * -9.0)))));
	end
	return 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_] := If[LessEqual[N[(y * 9.0), $MachinePrecision], -5e+57], N[(x * 2.0 + N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * x + N[(a * N[(27.0 * b), $MachinePrecision] + N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;y \cdot 9 \leq -5 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(y, t \cdot \left(z \cdot -9\right), \left(a \cdot 27\right) \cdot b\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, x, \mathsf{fma}\left(a, 27 \cdot b, z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\right)\right)\\


\end{array}

Error?

Target

Original3.0
Target3.4
Herbie0.8
\[\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 (*.f64 y 9) < -4.99999999999999972e57

    1. Initial program 5.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. Simplified1.1

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

      [Start]5.8

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

      associate-+l- [=>]5.8

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

      fma-neg [=>]5.8

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

      neg-sub0 [=>]5.8

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

      associate-+l- [<=]5.8

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

      neg-sub0 [<=]5.8

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

      *-commutative [=>]5.8

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

      distribute-lft-neg-in [=>]5.8

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

      associate-*l* [=>]5.7

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

      *-commutative [=>]5.7

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

      associate-*r* [=>]1.1

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

      *-commutative [=>]1.1

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

      fma-def [=>]1.1

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

      distribute-lft-neg-in [<=]1.1

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

      distribute-rgt-neg-in [=>]1.1

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

      *-commutative [=>]1.1

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

      distribute-rgt-neg-in [=>]1.1

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

      metadata-eval [=>]1.1

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

    if -4.99999999999999972e57 < (*.f64 y 9)

    1. Initial program 0.9

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

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

      [Start]0.9

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

      associate-*l* [=>]4.2

      \[ \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 \]

      associate-*l* [=>]4.2

      \[ \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
    3. Taylor expanded in x around 0 4.1

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

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

      [Start]4.1

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

      *-commutative [<=]4.1

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

      associate-*r* [=>]4.2

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

      *-commutative [<=]4.2

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

      associate-*r* [<=]4.2

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

      *-commutative [<=]4.2

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

      associate-*r* [=>]4.2

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

      *-commutative [<=]4.2

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

      associate--l+ [=>]4.2

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

      *-commutative [=>]4.2

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

      *-commutative [=>]4.2

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

      associate-*r* [<=]4.2

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

      *-commutative [=>]4.2

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

      cancel-sign-sub-inv [=>]4.2

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

      associate-*r* [=>]4.2

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

      *-commutative [=>]4.2

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

      associate-*r* [<=]4.1

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

      metadata-eval [=>]4.1

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

      +-commutative [<=]4.1

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

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

Alternatives

Alternative 1
Error0.8
Cost13892
\[\begin{array}{l} \mathbf{if}\;y \cdot 9 \leq -5 \cdot 10^{+57}:\\ \;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 + y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, x, \mathsf{fma}\left(a, 27 \cdot b, z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\right)\right)\\ \end{array} \]
Alternative 2
Error0.8
Cost7492
\[\begin{array}{l} \mathbf{if}\;z \leq 3.25 \cdot 10^{+47}:\\ \;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 + y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot \left(z \cdot \left(y \cdot -9\right)\right) + x \cdot 2\right) + a \cdot \left(27 \cdot b\right)\\ \end{array} \]
Alternative 3
Error19.1
Cost2020
\[\begin{array}{l} t_1 := y \cdot \left(t \cdot z\right)\\ t_2 := x \cdot 2 - \left(y \cdot 9\right) \cdot \left(t \cdot z\right)\\ t_3 := 27 \cdot \left(a \cdot b\right)\\ t_4 := t_3 - 9 \cdot t_1\\ t_5 := x \cdot 2 + t_3\\ \mathbf{if}\;t \leq 1.5 \cdot 10^{-27}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;t \leq 3.7 \cdot 10^{+107}:\\ \;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right) + x \cdot 2\\ \mathbf{elif}\;t \leq 1.7 \cdot 10^{+161}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq 5.6 \cdot 10^{+189}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 8.8 \cdot 10^{+210}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq 3.25 \cdot 10^{+217}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{+221}:\\ \;\;\;\;-9 \cdot t_1\\ \mathbf{elif}\;t \leq 6.8 \cdot 10^{+247}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{+255}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 4
Error19.2
Cost2020
\[\begin{array}{l} t_1 := y \cdot \left(t \cdot z\right)\\ t_2 := x \cdot 2 - \left(y \cdot 9\right) \cdot \left(t \cdot z\right)\\ t_3 := 27 \cdot \left(a \cdot b\right)\\ t_4 := x \cdot 2 + t_3\\ t_5 := t_3 + y \cdot \left(-9 \cdot \left(t \cdot z\right)\right)\\ \mathbf{if}\;t \leq 6.9 \cdot 10^{-29}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq 5.7 \cdot 10^{+104}:\\ \;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right) + x \cdot 2\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{+161}:\\ \;\;\;\;t_3 - 9 \cdot t_1\\ \mathbf{elif}\;t \leq 5.6 \cdot 10^{+189}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.35 \cdot 10^{+215}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;t \leq 3.25 \cdot 10^{+217}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{+221}:\\ \;\;\;\;-9 \cdot t_1\\ \mathbf{elif}\;t \leq 3.1 \cdot 10^{+246}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq 5.3 \cdot 10^{+253}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_5\\ \end{array} \]
Alternative 5
Error18.1
Cost1497
\[\begin{array}{l} t_1 := x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;y \leq -7.4 \cdot 10^{+230}:\\ \;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{+129}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;y \leq -7.5 \cdot 10^{+56} \lor \neg \left(y \leq -2.2 \cdot 10^{+35}\right) \land y \leq 2.5 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right) + x \cdot 2\\ \end{array} \]
Alternative 6
Error19.1
Cost1369
\[\begin{array}{l} t_1 := x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;x \leq -1.55 \cdot 10^{-71}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{-266}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-298}:\\ \;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{-220} \lor \neg \left(x \leq 1.26 \cdot 10^{-167}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\ \end{array} \]
Alternative 7
Error28.3
Cost1244
\[\begin{array}{l} t_1 := a \cdot \left(27 \cdot b\right)\\ t_2 := y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{if}\;x \leq -7.2 \cdot 10^{-14}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-102}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.18 \cdot 10^{-278}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-298}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-220}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-133}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 8
Error28.5
Cost1244
\[\begin{array}{l} t_1 := y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\ t_2 := a \cdot \left(27 \cdot b\right)\\ \mathbf{if}\;x \leq -3 \cdot 10^{-17}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -3.25 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-265}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-298}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-223}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+41}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 9
Error28.5
Cost1244
\[\begin{array}{l} t_1 := a \cdot \left(27 \cdot b\right)\\ \mathbf{if}\;x \leq -2.2 \cdot 10^{-21}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq -8 \cdot 10^{-265}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-298}:\\ \;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-221}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-132}:\\ \;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+41}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 10
Error28.5
Cost1244
\[\begin{array}{l} t_1 := a \cdot \left(27 \cdot b\right)\\ \mathbf{if}\;x \leq -8 \cdot 10^{-15}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-102}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\ \mathbf{elif}\;x \leq -8 \cdot 10^{-265}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-298}:\\ \;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-223}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{-133}:\\ \;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 11
Error0.7
Cost1220
\[\begin{array}{l} \mathbf{if}\;z \leq 9 \cdot 10^{-87}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(t \cdot z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right)\\ \end{array} \]
Alternative 12
Error3.0
Cost1088
\[\left(t \cdot \left(z \cdot \left(y \cdot -9\right)\right) + x \cdot 2\right) + a \cdot \left(27 \cdot b\right) \]
Alternative 13
Error13.7
Cost969
\[\begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{-40} \lor \neg \left(b \leq 3.75 \cdot 10^{-56}\right):\\ \;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 - \left(y \cdot 9\right) \cdot \left(t \cdot z\right)\\ \end{array} \]
Alternative 14
Error27.9
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-6}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{+41}:\\ \;\;\;\;27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 15
Error27.9
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{-8}:\\ \;\;\;\;x \cdot 2\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{+41}:\\ \;\;\;\;a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2\\ \end{array} \]
Alternative 16
Error37.1
Cost192
\[x \cdot 2 \]

Error

Reproduce?

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