Average Error: 20.5 → 18.1
Time: 16.9s
Precision: 64
\[\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 = -\infty:\\ \;\;\;\;\log \left({\left(e^{2 \cdot \sqrt{x}}\right)}^{\left(\mathsf{fma}\left(\cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right), \cos y, \sin \left(\frac{z \cdot t}{3}\right) \cdot \sin y\right)\right)}\right) - \frac{1}{b} \cdot \frac{a}{3}\\ \mathbf{elif}\;z \cdot t \le 2.13358673845001374 \cdot 10^{302}:\\ \;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right) - \sin y \cdot \left(\left(\sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)} \cdot \sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)}\right) \cdot \sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)}\right)\right) - \frac{a}{b \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\log \left({\left(e^{2 \cdot \sqrt{x}}\right)}^{\left(\mathsf{fma}\left(\cos y, \cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right), \sin y \cdot \sin \left(\frac{z \cdot t}{3}\right)\right)\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}\;z \cdot t = -\infty:\\
\;\;\;\;\log \left({\left(e^{2 \cdot \sqrt{x}}\right)}^{\left(\mathsf{fma}\left(\cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right), \cos y, \sin \left(\frac{z \cdot t}{3}\right) \cdot \sin y\right)\right)}\right) - \frac{1}{b} \cdot \frac{a}{3}\\

\mathbf{elif}\;z \cdot t \le 2.13358673845001374 \cdot 10^{302}:\\
\;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right) - \sin y \cdot \left(\left(\sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)} \cdot \sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)}\right) \cdot \sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)}\right)\right) - \frac{a}{b \cdot 3}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r700571 = 2.0;
        double r700572 = x;
        double r700573 = sqrt(r700572);
        double r700574 = r700571 * r700573;
        double r700575 = y;
        double r700576 = z;
        double r700577 = t;
        double r700578 = r700576 * r700577;
        double r700579 = 3.0;
        double r700580 = r700578 / r700579;
        double r700581 = r700575 - r700580;
        double r700582 = cos(r700581);
        double r700583 = r700574 * r700582;
        double r700584 = a;
        double r700585 = b;
        double r700586 = r700585 * r700579;
        double r700587 = r700584 / r700586;
        double r700588 = r700583 - r700587;
        return r700588;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r700589 = z;
        double r700590 = t;
        double r700591 = r700589 * r700590;
        double r700592 = -inf.0;
        bool r700593 = r700591 <= r700592;
        double r700594 = 2.0;
        double r700595 = x;
        double r700596 = sqrt(r700595);
        double r700597 = r700594 * r700596;
        double r700598 = exp(r700597);
        double r700599 = 0.3333333333333333;
        double r700600 = r700590 * r700589;
        double r700601 = r700599 * r700600;
        double r700602 = cos(r700601);
        double r700603 = y;
        double r700604 = cos(r700603);
        double r700605 = 3.0;
        double r700606 = r700591 / r700605;
        double r700607 = sin(r700606);
        double r700608 = sin(r700603);
        double r700609 = r700607 * r700608;
        double r700610 = fma(r700602, r700604, r700609);
        double r700611 = pow(r700598, r700610);
        double r700612 = log(r700611);
        double r700613 = 1.0;
        double r700614 = b;
        double r700615 = r700613 / r700614;
        double r700616 = a;
        double r700617 = r700616 / r700605;
        double r700618 = r700615 * r700617;
        double r700619 = r700612 - r700618;
        double r700620 = 2.1335867384500137e+302;
        bool r700621 = r700591 <= r700620;
        double r700622 = r700604 * r700602;
        double r700623 = -r700606;
        double r700624 = sin(r700623);
        double r700625 = cbrt(r700624);
        double r700626 = r700625 * r700625;
        double r700627 = r700626 * r700625;
        double r700628 = r700608 * r700627;
        double r700629 = r700622 - r700628;
        double r700630 = r700597 * r700629;
        double r700631 = r700614 * r700605;
        double r700632 = r700616 / r700631;
        double r700633 = r700630 - r700632;
        double r700634 = r700608 * r700607;
        double r700635 = fma(r700604, r700602, r700634);
        double r700636 = pow(r700598, r700635);
        double r700637 = log(r700636);
        double r700638 = r700637 - r700632;
        double r700639 = r700621 ? r700633 : r700638;
        double r700640 = r700593 ? r700619 : r700639;
        return r700640;
}

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

Target

Original20.5
Target18.5
Herbie18.1
\[\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 3 regimes
  2. if (* z t) < -inf.0

    1. Initial program 64.0

      \[\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 sub-neg64.0

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \cos \color{blue}{\left(y + \left(-\frac{z \cdot t}{3}\right)\right)} - \frac{a}{b \cdot 3}\]
    4. Applied cos-sum64.0

      \[\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}\]
    5. Simplified64.0

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\color{blue}{\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}\]
    6. Taylor expanded around inf 64.0

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \color{blue}{\cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right)} - \sin y \cdot \sin \left(-\frac{z \cdot t}{3}\right)\right) - \frac{a}{b \cdot 3}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity64.0

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right) - \sin y \cdot \sin \left(-\frac{z \cdot t}{3}\right)\right) - \frac{\color{blue}{1 \cdot a}}{b \cdot 3}\]
    9. Applied times-frac64.0

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right) - \sin y \cdot \sin \left(-\frac{z \cdot t}{3}\right)\right) - \color{blue}{\frac{1}{b} \cdot \frac{a}{3}}\]
    10. Using strategy rm
    11. Applied add-log-exp64.0

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

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

    if -inf.0 < (* z t) < 2.1335867384500137e+302

    1. Initial program 14.1

      \[\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 sub-neg14.1

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \cos \color{blue}{\left(y + \left(-\frac{z \cdot t}{3}\right)\right)} - \frac{a}{b \cdot 3}\]
    4. Applied cos-sum13.7

      \[\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}\]
    5. Simplified13.7

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\color{blue}{\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}\]
    6. Taylor expanded around inf 13.7

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \color{blue}{\cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right)} - \sin y \cdot \sin \left(-\frac{z \cdot t}{3}\right)\right) - \frac{a}{b \cdot 3}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt13.7

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

    if 2.1335867384500137e+302 < (* z t)

    1. Initial program 63.0

      \[\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 sub-neg63.0

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \cos \color{blue}{\left(y + \left(-\frac{z \cdot t}{3}\right)\right)} - \frac{a}{b \cdot 3}\]
    4. Applied cos-sum63.0

      \[\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}\]
    5. Simplified63.0

      \[\leadsto \left(2 \cdot \sqrt{x}\right) \cdot \left(\color{blue}{\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}\]
    6. Taylor expanded around inf 62.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t = -\infty:\\ \;\;\;\;\log \left({\left(e^{2 \cdot \sqrt{x}}\right)}^{\left(\mathsf{fma}\left(\cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right), \cos y, \sin \left(\frac{z \cdot t}{3}\right) \cdot \sin y\right)\right)}\right) - \frac{1}{b} \cdot \frac{a}{3}\\ \mathbf{elif}\;z \cdot t \le 2.13358673845001374 \cdot 10^{302}:\\ \;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \left(\cos y \cdot \cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right) - \sin y \cdot \left(\left(\sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)} \cdot \sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)}\right) \cdot \sqrt[3]{\sin \left(-\frac{z \cdot t}{3}\right)}\right)\right) - \frac{a}{b \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\log \left({\left(e^{2 \cdot \sqrt{x}}\right)}^{\left(\mathsf{fma}\left(\cos y, \cos \left(0.333333333333333315 \cdot \left(t \cdot z\right)\right), \sin y \cdot \sin \left(\frac{z \cdot t}{3}\right)\right)\right)}\right) - \frac{a}{b \cdot 3}\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(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.379333748723514e+129) (- (* (* 2 (sqrt x)) (cos (- (/ 1 y) (/ (/ 0.3333333333333333 z) t)))) (/ (/ a 3) b)) (if (< z 3.516290613555987e+106) (- (* (* (sqrt x) 2) (cos (- y (* (/ t 3) z)))) (/ (/ a 3) b)) (- (* (cos (- y (/ (/ 0.3333333333333333 z) t))) (* 2 (sqrt x))) (/ (/ a b) 3))))

  (- (* (* 2 (sqrt x)) (cos (- y (/ (* z t) 3)))) (/ a (* b 3))))