Average Error: 7.7 → 5.8
Time: 16.4s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.572362284185497406689836341338858708353 \cdot 10^{169}:\\ \;\;\;\;\left(x \cdot 0.5\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.06216374958764225126753729940763549145 \cdot 10^{-42}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y \le -4.957254077664300945355147434113679116384 \cdot 10^{-233}:\\ \;\;\;\;\left(x \cdot 0.5\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 4.649423560858470951768732044813138323666 \cdot 10^{131}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{y}{\sqrt[3]{a}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.572362284185497406689836341338858708353 \cdot 10^{169}:\\
\;\;\;\;\left(x \cdot 0.5\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;x \cdot y \le -1.06216374958764225126753729940763549145 \cdot 10^{-42}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;x \cdot y \le -4.957254077664300945355147434113679116384 \cdot 10^{-233}:\\
\;\;\;\;\left(x \cdot 0.5\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;x \cdot y \le 4.649423560858470951768732044813138323666 \cdot 10^{131}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{y}{\sqrt[3]{a}} - 4.5 \cdot \frac{t \cdot z}{a}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r48615 = x;
        double r48616 = y;
        double r48617 = r48615 * r48616;
        double r48618 = z;
        double r48619 = 9.0;
        double r48620 = r48618 * r48619;
        double r48621 = t;
        double r48622 = r48620 * r48621;
        double r48623 = r48617 - r48622;
        double r48624 = a;
        double r48625 = 2.0;
        double r48626 = r48624 * r48625;
        double r48627 = r48623 / r48626;
        return r48627;
}

double f(double x, double y, double z, double t, double a) {
        double r48628 = x;
        double r48629 = y;
        double r48630 = r48628 * r48629;
        double r48631 = -1.5723622841854974e+169;
        bool r48632 = r48630 <= r48631;
        double r48633 = 0.5;
        double r48634 = r48628 * r48633;
        double r48635 = a;
        double r48636 = r48629 / r48635;
        double r48637 = r48634 * r48636;
        double r48638 = 4.5;
        double r48639 = t;
        double r48640 = z;
        double r48641 = r48639 * r48640;
        double r48642 = r48641 / r48635;
        double r48643 = r48638 * r48642;
        double r48644 = r48637 - r48643;
        double r48645 = -1.0621637495876423e-42;
        bool r48646 = r48630 <= r48645;
        double r48647 = r48630 / r48635;
        double r48648 = r48633 * r48647;
        double r48649 = r48635 / r48640;
        double r48650 = r48639 / r48649;
        double r48651 = r48638 * r48650;
        double r48652 = r48648 - r48651;
        double r48653 = -4.957254077664301e-233;
        bool r48654 = r48630 <= r48653;
        double r48655 = 4.649423560858471e+131;
        bool r48656 = r48630 <= r48655;
        double r48657 = cbrt(r48635);
        double r48658 = r48657 * r48657;
        double r48659 = r48639 / r48658;
        double r48660 = r48640 / r48657;
        double r48661 = r48659 * r48660;
        double r48662 = r48638 * r48661;
        double r48663 = r48648 - r48662;
        double r48664 = r48628 / r48658;
        double r48665 = r48633 * r48664;
        double r48666 = r48629 / r48657;
        double r48667 = r48665 * r48666;
        double r48668 = r48667 - r48643;
        double r48669 = r48656 ? r48663 : r48668;
        double r48670 = r48654 ? r48644 : r48669;
        double r48671 = r48646 ? r48652 : r48670;
        double r48672 = r48632 ? r48644 : r48671;
        return r48672;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.7
Target5.6
Herbie5.8
\[\begin{array}{l} \mathbf{if}\;a \lt -2.090464557976709043451944897028999329376 \cdot 10^{86}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \lt 2.144030707833976090627817222818061808815 \cdot 10^{99}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (* x y) < -1.5723622841854974e+169 or -1.0621637495876423e-42 < (* x y) < -4.957254077664301e-233

    1. Initial program 12.3

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 12.1

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity12.1

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{\color{blue}{1 \cdot a}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Applied times-frac8.1

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x}{1} \cdot \frac{y}{a}\right)} - 4.5 \cdot \frac{t \cdot z}{a}\]
    6. Applied associate-*r*8.1

      \[\leadsto \color{blue}{\left(0.5 \cdot \frac{x}{1}\right) \cdot \frac{y}{a}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    7. Simplified8.1

      \[\leadsto \color{blue}{\left(x \cdot 0.5\right)} \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\]

    if -1.5723622841854974e+169 < (* x y) < -1.0621637495876423e-42

    1. Initial program 3.6

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 3.4

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    3. Using strategy rm
    4. Applied associate-/l*3.6

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\]

    if -4.957254077664301e-233 < (* x y) < 4.649423560858471e+131

    1. Initial program 4.9

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 4.9

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt5.4

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    5. Applied times-frac5.2

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)}\]

    if 4.649423560858471e+131 < (* x y)

    1. Initial program 18.7

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 18.7

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt19.4

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Applied times-frac7.4

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right)} - 4.5 \cdot \frac{t \cdot z}{a}\]
    6. Applied associate-*r*7.3

      \[\leadsto \color{blue}{\left(0.5 \cdot \frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{y}{\sqrt[3]{a}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification5.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.572362284185497406689836341338858708353 \cdot 10^{169}:\\ \;\;\;\;\left(x \cdot 0.5\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.06216374958764225126753729940763549145 \cdot 10^{-42}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y \le -4.957254077664300945355147434113679116384 \cdot 10^{-233}:\\ \;\;\;\;\left(x \cdot 0.5\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 4.649423560858470951768732044813138323666 \cdot 10^{131}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{y}{\sqrt[3]{a}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< a -2.090464557976709e86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.14403070783397609e99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9) t)) (* a 2)))