Average Error: 20.7 → 18.3
Time: 15.5s
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}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 7.686065033283073 \cdot 10^{+300}\right):\\ \;\;\;\;2 \cdot \log \left({\left(e^{\sqrt{x}}\right)}^{\left(\cos \left(z \cdot \frac{t}{3}\right) \cdot \cos y + \sin \left(z \cdot \frac{t}{3}\right) \cdot \sin y\right)}\right) - \frac{a}{3 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \left(\sin \left(z \cdot \frac{t}{3}\right) \cdot \sin y + \cos y \cdot \log \left(e^{\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)}\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}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 7.686065033283073 \cdot 10^{+300}\right):\\
\;\;\;\;2 \cdot \log \left({\left(e^{\sqrt{x}}\right)}^{\left(\cos \left(z \cdot \frac{t}{3}\right) \cdot \cos y + \sin \left(z \cdot \frac{t}{3}\right) \cdot \sin y\right)}\right) - \frac{a}{3 \cdot b}\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\sqrt{x} \cdot \left(\sin \left(z \cdot \frac{t}{3}\right) \cdot \sin y + \cos y \cdot \log \left(e^{\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)}\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 (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 7.686065033283073e+300)))
   (-
    (*
     2.0
     (log
      (pow
       (exp (sqrt x))
       (+
        (* (cos (* z (/ t 3.0))) (cos y))
        (* (sin (* z (/ t 3.0))) (sin y))))))
    (/ a (* 3.0 b)))
   (-
    (*
     2.0
     (*
      (sqrt x)
      (+
       (* (sin (* z (/ t 3.0))) (sin y))
       (* (cos y) (log (exp (cos (* z (* t 0.3333333333333333)))))))))
    (/ 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) (z * t)) <= ((double) -(((double) INFINITY)))) || !(((double) (z * t)) <= 7.686065033283073e+300))) {
		tmp = ((double) (((double) (2.0 * ((double) log(((double) pow(((double) exp(((double) sqrt(x)))), ((double) (((double) (((double) cos(((double) (z * (t / 3.0))))) * ((double) cos(y)))) + ((double) (((double) sin(((double) (z * (t / 3.0))))) * ((double) sin(y)))))))))))) - (a / ((double) (3.0 * b)))));
	} else {
		tmp = ((double) (((double) (2.0 * ((double) (((double) sqrt(x)) * ((double) (((double) (((double) sin(((double) (z * (t / 3.0))))) * ((double) sin(y)))) + ((double) (((double) cos(y)) * ((double) log(((double) exp(((double) cos(((double) (z * ((double) (t * 0.3333333333333333)))))))))))))))))) - (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
Herbie18.3
\[\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 (* z t) < -inf.0 or 7.68606503328307317e300 < (* z t)

    1. Initial program Error: 63.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: 63.1 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: 63.1 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. Using strategy rm
    6. Applied add-log-expError: 63.4 bits

      \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\sqrt{x} \cdot \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}\]
    7. SimplifiedError: 47.5 bits

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

    if -inf.0 < (* z t) < 7.68606503328307317e300

    1. Initial program Error: 14.4 bits

      \[\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}\]
    2. SimplifiedError: 14.4 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: 13.9 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. Taylor expanded around inf Error: 13.9 bits

      \[\leadsto 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(z \cdot \frac{t}{3}\right)\right)\right) - \frac{a}{3 \cdot b}\]
    6. SimplifiedError: 13.9 bits

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 7.686065033283073 \cdot 10^{+300}\right):\\ \;\;\;\;2 \cdot \log \left({\left(e^{\sqrt{x}}\right)}^{\left(\cos \left(z \cdot \frac{t}{3}\right) \cdot \cos y + \sin \left(z \cdot \frac{t}{3}\right) \cdot \sin y\right)}\right) - \frac{a}{3 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{x} \cdot \left(\sin \left(z \cdot \frac{t}{3}\right) \cdot \sin y + \cos y \cdot \log \left(e^{\cos \left(z \cdot \left(t \cdot 0.3333333333333333\right)\right)}\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))))