Average Error: 8.0 → 4.7
Time: 43.0s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \frac{t \cdot z}{a} \cdot 4.5\\ \mathbf{elif}\;x \cdot y \le -1.700987122981420393486078836562591273693 \cdot 10^{-138}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{elif}\;x \cdot y \le 4.218770597730928417548533567320967175831 \cdot 10^{-132}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right) - \frac{t \cdot z}{a} \cdot 4.5\\ \mathbf{elif}\;x \cdot y \le 6.886896017153368770786747800397779805695 \cdot 10^{170}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right) - \frac{t \cdot z}{a} \cdot 4.5\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \frac{t \cdot z}{a} \cdot 4.5\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r36752132 = x;
        double r36752133 = y;
        double r36752134 = r36752132 * r36752133;
        double r36752135 = z;
        double r36752136 = 9.0;
        double r36752137 = r36752135 * r36752136;
        double r36752138 = t;
        double r36752139 = r36752137 * r36752138;
        double r36752140 = r36752134 - r36752139;
        double r36752141 = a;
        double r36752142 = 2.0;
        double r36752143 = r36752141 * r36752142;
        double r36752144 = r36752140 / r36752143;
        return r36752144;
}

double f(double x, double y, double z, double t, double a) {
        double r36752145 = x;
        double r36752146 = y;
        double r36752147 = r36752145 * r36752146;
        double r36752148 = -inf.0;
        bool r36752149 = r36752147 <= r36752148;
        double r36752150 = a;
        double r36752151 = r36752150 / r36752146;
        double r36752152 = r36752145 / r36752151;
        double r36752153 = 0.5;
        double r36752154 = r36752152 * r36752153;
        double r36752155 = t;
        double r36752156 = z;
        double r36752157 = r36752155 * r36752156;
        double r36752158 = r36752157 / r36752150;
        double r36752159 = 4.5;
        double r36752160 = r36752158 * r36752159;
        double r36752161 = r36752154 - r36752160;
        double r36752162 = -1.7009871229814204e-138;
        bool r36752163 = r36752147 <= r36752162;
        double r36752164 = r36752147 / r36752150;
        double r36752165 = r36752153 * r36752164;
        double r36752166 = r36752156 / r36752150;
        double r36752167 = r36752166 * r36752155;
        double r36752168 = r36752159 * r36752167;
        double r36752169 = r36752165 - r36752168;
        double r36752170 = 4.2187705977309284e-132;
        bool r36752171 = r36752147 <= r36752170;
        double r36752172 = r36752146 / r36752150;
        double r36752173 = r36752172 * r36752145;
        double r36752174 = r36752153 * r36752173;
        double r36752175 = r36752174 - r36752160;
        double r36752176 = 6.886896017153369e+170;
        bool r36752177 = r36752147 <= r36752176;
        double r36752178 = r36752177 ? r36752169 : r36752175;
        double r36752179 = r36752171 ? r36752175 : r36752178;
        double r36752180 = r36752163 ? r36752169 : r36752179;
        double r36752181 = r36752149 ? r36752161 : r36752180;
        return r36752181;
}

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

Original8.0
Target5.6
Herbie4.7
\[\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 3 regimes
  2. if (* x y) < -inf.0

    1. Initial program 64.0

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

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

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

    if -inf.0 < (* x y) < -1.7009871229814204e-138 or 4.2187705977309284e-132 < (* x y) < 6.886896017153369e+170

    1. Initial program 3.9

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

      \[\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-identity3.8

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

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

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

    if -1.7009871229814204e-138 < (* x y) < 4.2187705977309284e-132 or 6.886896017153369e+170 < (* x y)

    1. Initial program 8.9

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 8.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 *-un-lft-identity8.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \frac{t \cdot z}{a} \cdot 4.5\\ \mathbf{elif}\;x \cdot y \le -1.700987122981420393486078836562591273693 \cdot 10^{-138}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{elif}\;x \cdot y \le 4.218770597730928417548533567320967175831 \cdot 10^{-132}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right) - \frac{t \cdot z}{a} \cdot 4.5\\ \mathbf{elif}\;x \cdot y \le 6.886896017153368770786747800397779805695 \cdot 10^{170}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right) - \frac{t \cdot z}{a} \cdot 4.5\\ \end{array}\]

Reproduce

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

  :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.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))