Average Error: 7.6 → 4.0
Time: 6.2s
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 -2.21834298495767539 \cdot 10^{236}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.3603949856993749 \cdot 10^{34}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le 2.9090994917840058 \cdot 10^{187}:\\ \;\;\;\;\left(x \cdot y + \left(-\left(9 \cdot t\right) \cdot z\right)\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 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 -2.21834298495767539 \cdot 10^{236}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

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

\mathbf{elif}\;x \cdot y \le 2.9090994917840058 \cdot 10^{187}:\\
\;\;\;\;\left(x \cdot y + \left(-\left(9 \cdot t\right) \cdot z\right)\right) \cdot \frac{1}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r307732 = x;
        double r307733 = y;
        double r307734 = r307732 * r307733;
        double r307735 = z;
        double r307736 = 9.0;
        double r307737 = r307735 * r307736;
        double r307738 = t;
        double r307739 = r307737 * r307738;
        double r307740 = r307734 - r307739;
        double r307741 = a;
        double r307742 = 2.0;
        double r307743 = r307741 * r307742;
        double r307744 = r307740 / r307743;
        return r307744;
}

double f(double x, double y, double z, double t, double a) {
        double r307745 = x;
        double r307746 = y;
        double r307747 = r307745 * r307746;
        double r307748 = -2.2183429849576754e+236;
        bool r307749 = r307747 <= r307748;
        double r307750 = 0.5;
        double r307751 = a;
        double r307752 = r307751 / r307746;
        double r307753 = r307745 / r307752;
        double r307754 = r307750 * r307753;
        double r307755 = 4.5;
        double r307756 = t;
        double r307757 = z;
        double r307758 = r307756 * r307757;
        double r307759 = r307758 / r307751;
        double r307760 = r307755 * r307759;
        double r307761 = r307754 - r307760;
        double r307762 = -1.360394985699375e+34;
        bool r307763 = r307747 <= r307762;
        double r307764 = r307747 / r307751;
        double r307765 = r307750 * r307764;
        double r307766 = cbrt(r307751);
        double r307767 = r307766 * r307766;
        double r307768 = r307756 / r307767;
        double r307769 = r307755 * r307768;
        double r307770 = r307757 / r307766;
        double r307771 = r307769 * r307770;
        double r307772 = r307765 - r307771;
        double r307773 = 2.9090994917840058e+187;
        bool r307774 = r307747 <= r307773;
        double r307775 = 9.0;
        double r307776 = r307775 * r307756;
        double r307777 = r307776 * r307757;
        double r307778 = -r307777;
        double r307779 = r307747 + r307778;
        double r307780 = 1.0;
        double r307781 = 2.0;
        double r307782 = r307751 * r307781;
        double r307783 = r307780 / r307782;
        double r307784 = r307779 * r307783;
        double r307785 = r307774 ? r307784 : r307761;
        double r307786 = r307763 ? r307772 : r307785;
        double r307787 = r307749 ? r307761 : r307786;
        return r307787;
}

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.6
Target5.6
Herbie4.0
\[\begin{array}{l} \mathbf{if}\;a \lt -2.090464557976709 \cdot 10^{86}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \lt 2.14403070783397609 \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 3 regimes
  2. if (* x y) < -2.2183429849576754e+236 or 2.9090994917840058e+187 < (* x y)

    1. Initial program 31.3

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 31.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 associate-/l*6.4

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

    if -2.2183429849576754e+236 < (* x y) < -1.360394985699375e+34

    1. Initial program 5.1

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

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

      \[\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)}\]
    6. Applied associate-*r*2.1

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

    if -1.360394985699375e+34 < (* x y) < 2.9090994917840058e+187

    1. Initial program 3.9

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied sub-neg3.9

      \[\leadsto \frac{\color{blue}{x \cdot y + \left(-\left(z \cdot 9\right) \cdot t\right)}}{a \cdot 2}\]
    4. Simplified3.9

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(-9 \cdot \left(t \cdot z\right)\right)}}{a \cdot 2}\]
    5. Using strategy rm
    6. Applied div-inv3.9

      \[\leadsto \color{blue}{\left(x \cdot y + \left(-9 \cdot \left(t \cdot z\right)\right)\right) \cdot \frac{1}{a \cdot 2}}\]
    7. Using strategy rm
    8. Applied associate-*r*4.0

      \[\leadsto \left(x \cdot y + \left(-\color{blue}{\left(9 \cdot t\right) \cdot z}\right)\right) \cdot \frac{1}{a \cdot 2}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification4.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -2.21834298495767539 \cdot 10^{236}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.3603949856993749 \cdot 10^{34}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le 2.9090994917840058 \cdot 10^{187}:\\ \;\;\;\;\left(x \cdot y + \left(-\left(9 \cdot t\right) \cdot z\right)\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

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