Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, K

?

Percentage Accurate: 70.4% → 77.6%
Time: 30.9s
Precision: binary64
Cost: 53828

?

\[\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3} \]
\[\begin{array}{l} t_1 := \frac{a}{3 \cdot b}\\ \mathbf{if}\;\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - t_1 \leq 5 \cdot 10^{+184}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \mathsf{fma}\left(\cos y, \cos \left(z \cdot \left(t \cdot -0.3333333333333333\right)\right), \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(z \cdot t\right)\right)\right)\right) - t_1\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \cos y\right) + \frac{a}{3} \cdot \frac{-1}{b}\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ a (* 3.0 b))))
   (if (<= (- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) t_1) 5e+184)
     (-
      (*
       2.0
       (*
        (sqrt x)
        (fma
         (cos y)
         (cos (* z (* t -0.3333333333333333)))
         (* (sin y) (sin (* 0.3333333333333333 (* z t)))))))
      t_1)
     (+ (* 2.0 (* (sqrt x) (cos y))) (* (/ a 3.0) (/ -1.0 b))))))
double code(double x, double y, double z, double t, double a, double b) {
	return ((2.0 * sqrt(x)) * cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0));
}
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a / (3.0 * b);
	double tmp;
	if ((((2.0 * sqrt(x)) * cos((y - ((z * t) / 3.0)))) - t_1) <= 5e+184) {
		tmp = (2.0 * (sqrt(x) * fma(cos(y), cos((z * (t * -0.3333333333333333))), (sin(y) * sin((0.3333333333333333 * (z * t))))))) - t_1;
	} else {
		tmp = (2.0 * (sqrt(x) * cos(y))) + ((a / 3.0) * (-1.0 / b));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(2.0 * sqrt(x)) * cos(Float64(y - Float64(Float64(z * t) / 3.0)))) - Float64(a / Float64(b * 3.0)))
end
function code(x, y, z, t, a, b)
	t_1 = Float64(a / Float64(3.0 * b))
	tmp = 0.0
	if (Float64(Float64(Float64(2.0 * sqrt(x)) * cos(Float64(y - Float64(Float64(z * t) / 3.0)))) - t_1) <= 5e+184)
		tmp = Float64(Float64(2.0 * Float64(sqrt(x) * fma(cos(y), cos(Float64(z * Float64(t * -0.3333333333333333))), Float64(sin(y) * sin(Float64(0.3333333333333333 * Float64(z * t))))))) - t_1);
	else
		tmp = Float64(Float64(2.0 * Float64(sqrt(x) * cos(y))) + Float64(Float64(a / 3.0) * Float64(-1.0 / b)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a / N[(3.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], 5e+184], N[(N[(2.0 * N[(N[Sqrt[x], $MachinePrecision] * N[(N[Cos[y], $MachinePrecision] * N[Cos[N[(z * N[(t * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[y], $MachinePrecision] * N[Sin[N[(0.3333333333333333 * N[(z * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(2.0 * N[(N[Sqrt[x], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a / 3.0), $MachinePrecision] * N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}
\begin{array}{l}
t_1 := \frac{a}{3 \cdot b}\\
\mathbf{if}\;\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - t_1 \leq 5 \cdot 10^{+184}:\\
\;\;\;\;2 \cdot \left(\sqrt{x} \cdot \mathsf{fma}\left(\cos y, \cos \left(z \cdot \left(t \cdot -0.3333333333333333\right)\right), \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(z \cdot t\right)\right)\right)\right) - t_1\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{x} \cdot \cos y\right) + \frac{a}{3} \cdot \frac{-1}{b}\\


\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 8 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Target

Original70.4%
Target74.3%
Herbie77.6%
\[\begin{array}{l} \mathbf{if}\;z < -1.3793337487235141 \cdot 10^{+129}:\\ \;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(\frac{1}{y} - \frac{\frac{0.3333333333333333}{z}}{t}\right) - \frac{\frac{a}{3}}{b}\\ \mathbf{elif}\;z < 3.516290613555987 \cdot 10^{+106}:\\ \;\;\;\;\left(\sqrt{x} \cdot 2\right) \cdot \cos \left(y - \frac{t}{3} \cdot z\right) - \frac{\frac{a}{3}}{b}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y - \frac{\frac{0.3333333333333333}{z}}{t}\right) \cdot \left(2 \cdot \sqrt{x}\right) - \frac{\frac{a}{b}}{3}\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 (*.f64 2 (sqrt.f64 x)) (cos.f64 (-.f64 y (/.f64 (*.f64 z t) 3)))) (/.f64 a (*.f64 b 3))) < 4.9999999999999999e184

    1. Initial program 75.9%

      \[\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3} \]
    2. Simplified75.8%

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{3} \cdot t\right)\right) - \frac{a}{3 \cdot b}} \]
      Step-by-step derivation

      [Start]75.9%

      \[ \left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3} \]

      associate-*l* [=>]75.9%

      \[ \color{blue}{2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right)\right)} - \frac{a}{b \cdot 3} \]

      fma-neg [=>]75.9%

      \[ \color{blue}{\mathsf{fma}\left(2, \sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right), -\frac{a}{b \cdot 3}\right)} \]

      remove-double-neg [<=]75.9%

      \[ \mathsf{fma}\left(2, \color{blue}{-\left(-\sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right)\right)}, -\frac{a}{b \cdot 3}\right) \]

      fma-neg [<=]75.9%

      \[ \color{blue}{2 \cdot \left(-\left(-\sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right)\right)\right) - \frac{a}{b \cdot 3}} \]

      remove-double-neg [=>]75.9%

      \[ 2 \cdot \color{blue}{\left(\sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right)\right)} - \frac{a}{b \cdot 3} \]

      associate-*l/ [<=]75.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \color{blue}{\frac{z}{3} \cdot t}\right)\right) - \frac{a}{b \cdot 3} \]

      *-commutative [=>]75.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{3} \cdot t\right)\right) - \frac{a}{\color{blue}{3 \cdot b}} \]
    3. Applied egg-rr76.5%

      \[\leadsto 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \color{blue}{{\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}}\right)\right) - \frac{a}{3 \cdot b} \]
      Step-by-step derivation

      [Start]75.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{3} \cdot t\right)\right) - \frac{a}{3 \cdot b} \]

      add-cube-cbrt [=>]76.2%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \color{blue}{\left(\sqrt[3]{\frac{z}{3} \cdot t} \cdot \sqrt[3]{\frac{z}{3} \cdot t}\right) \cdot \sqrt[3]{\frac{z}{3} \cdot t}}\right)\right) - \frac{a}{3 \cdot b} \]

      pow3 [=>]76.3%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \color{blue}{{\left(\sqrt[3]{\frac{z}{3} \cdot t}\right)}^{3}}\right)\right) - \frac{a}{3 \cdot b} \]

      *-commutative [=>]76.3%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - {\left(\sqrt[3]{\color{blue}{t \cdot \frac{z}{3}}}\right)}^{3}\right)\right) - \frac{a}{3 \cdot b} \]

      div-inv [=>]76.5%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - {\left(\sqrt[3]{t \cdot \color{blue}{\left(z \cdot \frac{1}{3}\right)}}\right)}^{3}\right)\right) - \frac{a}{3 \cdot b} \]

      metadata-eval [=>]76.5%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - {\left(\sqrt[3]{t \cdot \left(z \cdot \color{blue}{0.3333333333333333}\right)}\right)}^{3}\right)\right) - \frac{a}{3 \cdot b} \]
    4. Applied egg-rr77.9%

      \[\leadsto 2 \cdot \left(\sqrt{x} \cdot \color{blue}{\left(\cos y \cdot \cos \left(-0.3333333333333333 \cdot \left(t \cdot z\right)\right) + \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(t \cdot z\right)\right)\right)}\right) - \frac{a}{3 \cdot b} \]
      Step-by-step derivation

      [Start]76.5%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - {\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right) - \frac{a}{3 \cdot b} \]

      cos-diff [=>]77.6%

      \[ 2 \cdot \left(\sqrt{x} \cdot \color{blue}{\left(\cos y \cdot \cos \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right) + \sin y \cdot \sin \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right)}\right) - \frac{a}{3 \cdot b} \]

      unpow3 [=>]77.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \color{blue}{\left(\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)} \cdot \sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right) \cdot \sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)} + \sin y \cdot \sin \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right)\right) - \frac{a}{3 \cdot b} \]

      add-cube-cbrt [<=]77.2%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \color{blue}{\left(t \cdot \left(z \cdot 0.3333333333333333\right)\right)} + \sin y \cdot \sin \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right)\right) - \frac{a}{3 \cdot b} \]

      associate-*r* [=>]77.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \color{blue}{\left(\left(t \cdot z\right) \cdot 0.3333333333333333\right)} + \sin y \cdot \sin \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right)\right) - \frac{a}{3 \cdot b} \]

      *-commutative [<=]77.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \color{blue}{\left(0.3333333333333333 \cdot \left(t \cdot z\right)\right)} + \sin y \cdot \sin \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right)\right) - \frac{a}{3 \cdot b} \]

      cos-neg [<=]77.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \color{blue}{\cos \left(-0.3333333333333333 \cdot \left(t \cdot z\right)\right)} + \sin y \cdot \sin \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right)\right) - \frac{a}{3 \cdot b} \]

      distribute-lft-neg-in [=>]77.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \color{blue}{\left(\left(-0.3333333333333333\right) \cdot \left(t \cdot z\right)\right)} + \sin y \cdot \sin \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right)\right) - \frac{a}{3 \cdot b} \]

      metadata-eval [=>]77.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \left(\color{blue}{-0.3333333333333333} \cdot \left(t \cdot z\right)\right) + \sin y \cdot \sin \left({\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}^{3}\right)\right)\right) - \frac{a}{3 \cdot b} \]

      unpow3 [=>]77.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \left(-0.3333333333333333 \cdot \left(t \cdot z\right)\right) + \sin y \cdot \sin \color{blue}{\left(\left(\sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)} \cdot \sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right) \cdot \sqrt[3]{t \cdot \left(z \cdot 0.3333333333333333\right)}\right)}\right)\right) - \frac{a}{3 \cdot b} \]

      add-cube-cbrt [<=]77.9%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \left(-0.3333333333333333 \cdot \left(t \cdot z\right)\right) + \sin y \cdot \sin \color{blue}{\left(t \cdot \left(z \cdot 0.3333333333333333\right)\right)}\right)\right) - \frac{a}{3 \cdot b} \]

      associate-*r* [=>]77.9%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \left(-0.3333333333333333 \cdot \left(t \cdot z\right)\right) + \sin y \cdot \sin \color{blue}{\left(\left(t \cdot z\right) \cdot 0.3333333333333333\right)}\right)\right) - \frac{a}{3 \cdot b} \]

      *-commutative [<=]77.9%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \left(-0.3333333333333333 \cdot \left(t \cdot z\right)\right) + \sin y \cdot \sin \color{blue}{\left(0.3333333333333333 \cdot \left(t \cdot z\right)\right)}\right)\right) - \frac{a}{3 \cdot b} \]
    5. Simplified77.8%

      \[\leadsto 2 \cdot \left(\sqrt{x} \cdot \color{blue}{\mathsf{fma}\left(\cos y, \cos \left(\left(-0.3333333333333333 \cdot t\right) \cdot z\right), \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(t \cdot z\right)\right)\right)}\right) - \frac{a}{3 \cdot b} \]
      Step-by-step derivation

      [Start]77.9%

      \[ 2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos \left(-0.3333333333333333 \cdot \left(t \cdot z\right)\right) + \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(t \cdot z\right)\right)\right)\right) - \frac{a}{3 \cdot b} \]

      fma-def [=>]77.9%

      \[ 2 \cdot \left(\sqrt{x} \cdot \color{blue}{\mathsf{fma}\left(\cos y, \cos \left(-0.3333333333333333 \cdot \left(t \cdot z\right)\right), \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(t \cdot z\right)\right)\right)}\right) - \frac{a}{3 \cdot b} \]

      associate-*r* [=>]77.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \mathsf{fma}\left(\cos y, \cos \color{blue}{\left(\left(-0.3333333333333333 \cdot t\right) \cdot z\right)}, \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(t \cdot z\right)\right)\right)\right) - \frac{a}{3 \cdot b} \]

    if 4.9999999999999999e184 < (-.f64 (*.f64 (*.f64 2 (sqrt.f64 x)) (cos.f64 (-.f64 y (/.f64 (*.f64 z t) 3)))) (/.f64 a (*.f64 b 3)))

    1. Initial program 44.8%

      \[\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3} \]
    2. Simplified44.8%

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{\frac{3}{t}}\right)\right) - \frac{a}{3 \cdot b}} \]
      Step-by-step derivation

      [Start]44.8%

      \[ \left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3} \]

      associate-*l* [=>]44.8%

      \[ \color{blue}{2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right)\right)} - \frac{a}{b \cdot 3} \]

      fma-neg [=>]44.8%

      \[ \color{blue}{\mathsf{fma}\left(2, \sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right), -\frac{a}{b \cdot 3}\right)} \]

      remove-double-neg [<=]44.8%

      \[ \mathsf{fma}\left(2, \color{blue}{-\left(-\sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right)\right)}, -\frac{a}{b \cdot 3}\right) \]

      fma-neg [<=]44.8%

      \[ \color{blue}{2 \cdot \left(-\left(-\sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right)\right)\right) - \frac{a}{b \cdot 3}} \]

      remove-double-neg [=>]44.8%

      \[ 2 \cdot \color{blue}{\left(\sqrt{x} \cdot \cos \left(y - \frac{z \cdot t}{3}\right)\right)} - \frac{a}{b \cdot 3} \]

      associate-/l* [=>]44.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \color{blue}{\frac{z}{\frac{3}{t}}}\right)\right) - \frac{a}{b \cdot 3} \]

      *-commutative [=>]44.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{\frac{3}{t}}\right)\right) - \frac{a}{\color{blue}{3 \cdot b}} \]
    3. Applied egg-rr44.9%

      \[\leadsto 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{\frac{3}{t}}\right)\right) - \color{blue}{\frac{1}{b} \cdot \frac{a}{3}} \]
      Step-by-step derivation

      [Start]44.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{\frac{3}{t}}\right)\right) - \frac{a}{3 \cdot b} \]

      *-un-lft-identity [=>]44.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{\frac{3}{t}}\right)\right) - \frac{\color{blue}{1 \cdot a}}{3 \cdot b} \]

      *-commutative [=>]44.8%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{\frac{3}{t}}\right)\right) - \frac{1 \cdot a}{\color{blue}{b \cdot 3}} \]

      times-frac [=>]44.9%

      \[ 2 \cdot \left(\sqrt{x} \cdot \cos \left(y - \frac{z}{\frac{3}{t}}\right)\right) - \color{blue}{\frac{1}{b} \cdot \frac{a}{3}} \]
    4. Taylor expanded in z around 0 75.9%

      \[\leadsto 2 \cdot \left(\sqrt{x} \cdot \color{blue}{\cos y}\right) - \frac{1}{b} \cdot \frac{a}{3} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{3 \cdot b} \leq 5 \cdot 10^{+184}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \mathsf{fma}\left(\cos y, \cos \left(z \cdot \left(t \cdot -0.3333333333333333\right)\right), \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(z \cdot t\right)\right)\right)\right) - \frac{a}{3 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \cos y\right) + \frac{a}{3} \cdot \frac{-1}{b}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy77.6%
Cost53828
\[\begin{array}{l} t_1 := \frac{a}{3 \cdot b}\\ \mathbf{if}\;\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - t_1 \leq 5 \cdot 10^{+184}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \mathsf{fma}\left(\cos y, \cos \left(z \cdot \left(t \cdot -0.3333333333333333\right)\right), \sin y \cdot \sin \left(0.3333333333333333 \cdot \left(z \cdot t\right)\right)\right)\right) - t_1\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \cos y\right) + \frac{a}{3} \cdot \frac{-1}{b}\\ \end{array} \]
Alternative 2
Accuracy77.6%
Cost47556
\[\begin{array}{l} t_1 := \frac{z}{\frac{3}{t}}\\ t_2 := \frac{a}{3 \cdot b}\\ \mathbf{if}\;\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - t_2 \leq 5 \cdot 10^{+184}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \left(\cos y \cdot \cos t_1 + \sin y \cdot \sin t_1\right)\right) - t_2\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \cos y\right) + \frac{a}{3} \cdot \frac{-1}{b}\\ \end{array} \]
Alternative 3
Accuracy71.2%
Cost13897
\[\begin{array}{l} t_1 := \frac{a}{3 \cdot b}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{-45} \lor \neg \left(t_1 \leq 2 \cdot 10^{-188}\right):\\ \;\;\;\;2 \cdot \sqrt{x} - t_1\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \cos y\right)\\ \end{array} \]
Alternative 4
Accuracy76.5%
Cost13504
\[\left(2 \cdot \sqrt{x}\right) \cdot \cos y - \frac{a}{3 \cdot b} \]
Alternative 5
Accuracy65.4%
Cost6976
\[2 \cdot \sqrt{x} - \frac{a}{3 \cdot b} \]
Alternative 6
Accuracy51.1%
Cost320
\[a \cdot \frac{-0.3333333333333333}{b} \]
Alternative 7
Accuracy51.1%
Cost320
\[-0.3333333333333333 \cdot \frac{a}{b} \]
Alternative 8
Accuracy51.1%
Cost320
\[\frac{a \cdot -0.3333333333333333}{b} \]

Reproduce?

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

  :herbie-target
  (if (< z -1.3793337487235141e+129) (- (* (* 2.0 (sqrt x)) (cos (- (/ 1.0 y) (/ (/ 0.3333333333333333 z) t)))) (/ (/ a 3.0) b)) (if (< z 3.516290613555987e+106) (- (* (* (sqrt x) 2.0) (cos (- y (* (/ t 3.0) z)))) (/ (/ a 3.0) b)) (- (* (cos (- y (/ (/ 0.3333333333333333 z) t))) (* 2.0 (sqrt x))) (/ (/ a b) 3.0))))

  (- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))