Average Error: 7.6 → 4.0
Time: 7.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}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - \left(9 \cdot t\right) \cdot z}{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}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - \left(9 \cdot t\right) \cdot z}{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 r712635 = x;
        double r712636 = y;
        double r712637 = r712635 * r712636;
        double r712638 = z;
        double r712639 = 9.0;
        double r712640 = r712638 * r712639;
        double r712641 = t;
        double r712642 = r712640 * r712641;
        double r712643 = r712637 - r712642;
        double r712644 = a;
        double r712645 = 2.0;
        double r712646 = r712644 * r712645;
        double r712647 = r712643 / r712646;
        return r712647;
}

double f(double x, double y, double z, double t, double a) {
        double r712648 = x;
        double r712649 = y;
        double r712650 = r712648 * r712649;
        double r712651 = -2.2183429849576754e+236;
        bool r712652 = r712650 <= r712651;
        double r712653 = 0.5;
        double r712654 = a;
        double r712655 = r712654 / r712649;
        double r712656 = r712648 / r712655;
        double r712657 = r712653 * r712656;
        double r712658 = 4.5;
        double r712659 = t;
        double r712660 = z;
        double r712661 = r712659 * r712660;
        double r712662 = r712661 / r712654;
        double r712663 = r712658 * r712662;
        double r712664 = r712657 - r712663;
        double r712665 = -1.360394985699375e+34;
        bool r712666 = r712650 <= r712665;
        double r712667 = r712650 / r712654;
        double r712668 = r712653 * r712667;
        double r712669 = cbrt(r712654);
        double r712670 = r712669 * r712669;
        double r712671 = r712659 / r712670;
        double r712672 = r712658 * r712671;
        double r712673 = r712660 / r712669;
        double r712674 = r712672 * r712673;
        double r712675 = r712668 - r712674;
        double r712676 = 2.9090994917840058e+187;
        bool r712677 = r712650 <= r712676;
        double r712678 = 1.0;
        double r712679 = r712678 / r712654;
        double r712680 = 9.0;
        double r712681 = r712680 * r712659;
        double r712682 = r712681 * r712660;
        double r712683 = r712650 - r712682;
        double r712684 = 2.0;
        double r712685 = r712683 / r712684;
        double r712686 = r712679 * r712685;
        double r712687 = r712677 ? r712686 : r712664;
        double r712688 = r712666 ? r712675 : r712687;
        double r712689 = r712652 ? r712664 : r712688;
        return r712689;
}

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. Taylor expanded around inf 3.9

      \[\leadsto \frac{\color{blue}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}{a \cdot 2}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity3.9

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y - 9 \cdot \left(t \cdot z\right)\right)}}{a \cdot 2}\]
    5. Applied times-frac3.9

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

      \[\leadsto \frac{1}{a} \cdot \frac{x \cdot y - \color{blue}{\left(9 \cdot t\right) \cdot z}}{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}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - \left(9 \cdot t\right) \cdot z}{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)))