Average Error: 20.7 → 17.8
Time: 14.6s
Precision: binary64
\[\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}\]
\[\begin{array}{l} \mathbf{if}\;\cos \left(y - \frac{z \cdot t}{3}\right) \leq 0.9999999999993662:\\ \;\;\;\;2 \cdot \left(\cos y \cdot \left(\sqrt[3]{\log \left(e^{{\left(\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)\right)}^{3}}\right)} \cdot \sqrt{x}\right) + \sin y \cdot \left(\sqrt{x} \cdot \sin \left(z \cdot \frac{t}{3}\right)\right)\right) - \frac{a}{3 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \left(1 + y \cdot \left(y \cdot -0.5\right)\right)\right) - \frac{a}{3 \cdot b}\\ \end{array}\]
\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}
\begin{array}{l}
\mathbf{if}\;\cos \left(y - \frac{z \cdot t}{3}\right) \leq 0.9999999999993662:\\
\;\;\;\;2 \cdot \left(\cos y \cdot \left(\sqrt[3]{\log \left(e^{{\left(\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)\right)}^{3}}\right)} \cdot \sqrt{x}\right) + \sin y \cdot \left(\sqrt{x} \cdot \sin \left(z \cdot \frac{t}{3}\right)\right)\right) - \frac{a}{3 \cdot b}\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{x} \cdot \left(1 + y \cdot \left(y \cdot -0.5\right)\right)\right) - \frac{a}{3 \cdot 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
 (if (<= (cos (- y (/ (* z t) 3.0))) 0.9999999999993662)
   (-
    (*
     2.0
     (+
      (*
       (cos y)
       (*
        (cbrt (log (exp (pow (cos (* z (* t 0.3333333333333333))) 3.0))))
        (sqrt x)))
      (* (sin y) (* (sqrt x) (sin (* z (/ t 3.0)))))))
    (/ a (* 3.0 b)))
   (- (* 2.0 (* (sqrt x) (+ 1.0 (* y (* y -0.5))))) (/ a (* 3.0 b)))))
double code(double x, double y, double z, double t, double a, double b) {
	return ((double) (((double) (((double) (2.0 * ((double) sqrt(x)))) * ((double) cos(((double) (y - (((double) (z * t)) / 3.0))))))) - (a / ((double) (b * 3.0)))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((((double) cos(((double) (y - (((double) (z * t)) / 3.0))))) <= 0.9999999999993662)) {
		tmp = ((double) (((double) (2.0 * ((double) (((double) (((double) cos(y)) * ((double) (((double) cbrt(((double) log(((double) exp(((double) pow(((double) cos(((double) (z * ((double) (t * 0.3333333333333333)))))), 3.0)))))))) * ((double) sqrt(x)))))) + ((double) (((double) sin(y)) * ((double) (((double) sqrt(x)) * ((double) sin(((double) (z * (t / 3.0))))))))))))) - (a / ((double) (3.0 * b)))));
	} else {
		tmp = ((double) (((double) (2.0 * ((double) (((double) sqrt(x)) * ((double) (1.0 + ((double) (y * ((double) (y * -0.5)))))))))) - (a / ((double) (3.0 * b)))));
	}
	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

Original20.7
Target18.8
Herbie17.8
\[\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 (cos (- y (/ (* z t) 3.0))) < 0.999999999999366174

    1. Initial program Error: 19.9 bits

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

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{x} \cdot \cos \left(y - z \cdot \frac{t}{3}\right)\right) - \frac{a}{3 \cdot b}}\]
    3. Using strategy rm
    4. Applied cos-diffError: 19.2 bits

      \[\leadsto 2 \cdot \left(\sqrt{x} \cdot \color{blue}{\left(\cos y \cdot \cos \left(z \cdot \frac{t}{3}\right) + \sin y \cdot \sin \left(z \cdot \frac{t}{3}\right)\right)}\right) - \frac{a}{3 \cdot b}\]
    5. Applied distribute-lft-inError: 19.2 bits

      \[\leadsto 2 \cdot \color{blue}{\left(\sqrt{x} \cdot \left(\cos y \cdot \cos \left(z \cdot \frac{t}{3}\right)\right) + \sqrt{x} \cdot \left(\sin y \cdot \sin \left(z \cdot \frac{t}{3}\right)\right)\right)} - \frac{a}{3 \cdot b}\]
    6. SimplifiedError: 19.2 bits

      \[\leadsto 2 \cdot \left(\color{blue}{\cos y \cdot \left(\cos \left(z \cdot \frac{t}{3}\right) \cdot \sqrt{x}\right)} + \sqrt{x} \cdot \left(\sin y \cdot \sin \left(z \cdot \frac{t}{3}\right)\right)\right) - \frac{a}{3 \cdot b}\]
    7. SimplifiedError: 19.2 bits

      \[\leadsto 2 \cdot \left(\cos y \cdot \left(\cos \left(z \cdot \frac{t}{3}\right) \cdot \sqrt{x}\right) + \color{blue}{\sin y \cdot \left(\sin \left(z \cdot \frac{t}{3}\right) \cdot \sqrt{x}\right)}\right) - \frac{a}{3 \cdot b}\]
    8. Taylor expanded around inf Error: 19.2 bits

      \[\leadsto 2 \cdot \left(\cos y \cdot \left(\color{blue}{\cos \left(0.3333333333333333 \cdot \left(t \cdot z\right)\right)} \cdot \sqrt{x}\right) + \sin y \cdot \left(\sin \left(z \cdot \frac{t}{3}\right) \cdot \sqrt{x}\right)\right) - \frac{a}{3 \cdot b}\]
    9. SimplifiedError: 19.2 bits

      \[\leadsto 2 \cdot \left(\cos y \cdot \left(\color{blue}{\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)} \cdot \sqrt{x}\right) + \sin y \cdot \left(\sin \left(z \cdot \frac{t}{3}\right) \cdot \sqrt{x}\right)\right) - \frac{a}{3 \cdot b}\]
    10. Using strategy rm
    11. Applied add-cbrt-cubeError: 19.2 bits

      \[\leadsto 2 \cdot \left(\cos y \cdot \left(\color{blue}{\sqrt[3]{\left(\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right) \cdot \cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)\right) \cdot \cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)}} \cdot \sqrt{x}\right) + \sin y \cdot \left(\sin \left(z \cdot \frac{t}{3}\right) \cdot \sqrt{x}\right)\right) - \frac{a}{3 \cdot b}\]
    12. SimplifiedError: 19.2 bits

      \[\leadsto 2 \cdot \left(\cos y \cdot \left(\sqrt[3]{\color{blue}{{\left(\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)\right)}^{3}}} \cdot \sqrt{x}\right) + \sin y \cdot \left(\sin \left(z \cdot \frac{t}{3}\right) \cdot \sqrt{x}\right)\right) - \frac{a}{3 \cdot b}\]
    13. Using strategy rm
    14. Applied add-log-expError: 19.2 bits

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

    if 0.999999999999366174 < (cos (- y (/ (* z t) 3.0)))

    1. Initial program Error: 22.2 bits

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

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{x} \cdot \cos \left(y - z \cdot \frac{t}{3}\right)\right) - \frac{a}{3 \cdot b}}\]
    3. Taylor expanded around 0 Error: 15.3 bits

      \[\leadsto 2 \cdot \left(\sqrt{x} \cdot \color{blue}{\left(1 - 0.5 \cdot {y}^{2}\right)}\right) - \frac{a}{3 \cdot b}\]
    4. SimplifiedError: 15.3 bits

      \[\leadsto 2 \cdot \left(\sqrt{x} \cdot \color{blue}{\left(1 + y \cdot \left(y \cdot -0.5\right)\right)}\right) - \frac{a}{3 \cdot b}\]
  3. Recombined 2 regimes into one program.
  4. Final simplificationError: 17.8 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(y - \frac{z \cdot t}{3}\right) \leq 0.9999999999993662:\\ \;\;\;\;2 \cdot \left(\cos y \cdot \left(\sqrt[3]{\log \left(e^{{\left(\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)\right)}^{3}}\right)} \cdot \sqrt{x}\right) + \sin y \cdot \left(\sqrt{x} \cdot \sin \left(z \cdot \frac{t}{3}\right)\right)\right) - \frac{a}{3 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \left(1 + y \cdot \left(y \cdot -0.5\right)\right)\right) - \frac{a}{3 \cdot b}\\ \end{array}\]

Reproduce

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