Average Error: 21.0 → 18.4
Time: 4.5min
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}\;y - \frac{z \cdot t}{3} = -inf.0 \lor \neg \left(y - \frac{z \cdot t}{3} \le 8.9830031055829374 \cdot 10^{303}\right):\\ \;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(1 - \frac{1}{2} \cdot {y}^{2}\right) - \frac{a}{b \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \left(\log \left(\sqrt{e^{\cos \left(\frac{z \cdot t}{3}\right)}}\right) + \log \left(\sqrt{e^{\cos \left(\frac{z \cdot t}{3}\right)}}\right)\right) + \sin y \cdot \sin \left(\frac{1}{\frac{3}{z \cdot t}}\right)\right) - \frac{a}{b \cdot 3}\\ \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}\;y - \frac{z \cdot t}{3} = -inf.0 \lor \neg \left(y - \frac{z \cdot t}{3} \le 8.9830031055829374 \cdot 10^{303}\right):\\
\;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(1 - \frac{1}{2} \cdot {y}^{2}\right) - \frac{a}{b \cdot 3}\\

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

\end{array}
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 VAR;
	if (((((double) (y - (((double) (z * t)) / 3.0))) <= -inf.0) || !(((double) (y - (((double) (z * t)) / 3.0))) <= 8.983003105582937e+303))) {
		VAR = ((double) (((double) (((double) (2.0 * ((double) sqrt(x)))) * ((double) (1.0 - ((double) (0.5 * ((double) pow(y, 2.0)))))))) - (a / ((double) (b * 3.0)))));
	} else {
		VAR = ((double) (((double) (((double) (2.0 * ((double) sqrt(x)))) * ((double) (((double) (((double) cos(y)) * ((double) (((double) log(((double) sqrt(((double) exp(((double) cos((((double) (z * t)) / 3.0))))))))) + ((double) log(((double) sqrt(((double) exp(((double) cos((((double) (z * t)) / 3.0))))))))))))) + ((double) (((double) sin(y)) * ((double) sin((1.0 / (3.0 / ((double) (z * t)))))))))))) - (a / ((double) (b * 3.0)))));
	}
	return VAR;
}

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

Original21.0
Target19.1
Herbie18.4
\[\begin{array}{l} \mathbf{if}\;z \lt -1.379333748723514 \cdot 10^{129}:\\ \;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(\frac{1}{y} - \frac{\frac{0.333333333333333315}{z}}{t}\right) - \frac{\frac{a}{3}}{b}\\ \mathbf{elif}\;z \lt 3.51629061355598715 \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.333333333333333315}{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 (- y (/ (* z t) 3.0)) < -inf.0 or 8.9830031055829374e303 < (- y (/ (* z t) 3.0))

    1. Initial program 62.9

      \[\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}\]
    2. Taylor expanded around 0 45.9

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

    if -inf.0 < (- y (/ (* z t) 3.0)) < 8.9830031055829374e303

    1. Initial program 14.5

      \[\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}\]
    2. Using strategy rm
    3. Applied cos-diff14.1

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \color{blue}{\left(\cos y \cdot \cos \left(\frac{z \cdot t}{3}\right) + \sin y \cdot \sin \left(\frac{z \cdot t}{3}\right)\right)} - \frac{a}{b \cdot 3}\]
    4. Using strategy rm
    5. Applied clear-num14.1

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \cos \left(\frac{z \cdot t}{3}\right) + \sin y \cdot \sin \color{blue}{\left(\frac{1}{\frac{3}{z \cdot t}}\right)}\right) - \frac{a}{b \cdot 3}\]
    6. Using strategy rm
    7. Applied add-log-exp14.1

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \color{blue}{\log \left(e^{\cos \left(\frac{z \cdot t}{3}\right)}\right)} + \sin y \cdot \sin \left(\frac{1}{\frac{3}{z \cdot t}}\right)\right) - \frac{a}{b \cdot 3}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt14.1

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

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \color{blue}{\left(\log \left(\sqrt{e^{\cos \left(\frac{z \cdot t}{3}\right)}}\right) + \log \left(\sqrt{e^{\cos \left(\frac{z \cdot t}{3}\right)}}\right)\right)} + \sin y \cdot \sin \left(\frac{1}{\frac{3}{z \cdot t}}\right)\right) - \frac{a}{b \cdot 3}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification18.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;y - \frac{z \cdot t}{3} = -inf.0 \lor \neg \left(y - \frac{z \cdot t}{3} \le 8.9830031055829374 \cdot 10^{303}\right):\\ \;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(1 - \frac{1}{2} \cdot {y}^{2}\right) - \frac{a}{b \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \left(\log \left(\sqrt{e^{\cos \left(\frac{z \cdot t}{3}\right)}}\right) + \log \left(\sqrt{e^{\cos \left(\frac{z \cdot t}{3}\right)}}\right)\right) + \sin y \cdot \sin \left(\frac{1}{\frac{3}{z \cdot t}}\right)\right) - \frac{a}{b \cdot 3}\\ \end{array}\]

Reproduce

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