Average Error: 8.0 → 6.1
Time: 22.9s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;t \le -9312366130933649759010816:\\ \;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{elif}\;t \le 819283338.3549673557281494140625:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - \left(t \cdot 9\right) \cdot z}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - 4.5 \cdot \left(\frac{z}{\sqrt[3]{a}} \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right)\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;t \le -9312366130933649759010816:\\
\;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\

\mathbf{elif}\;t \le 819283338.3549673557281494140625:\\
\;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - \left(t \cdot 9\right) \cdot z}{2}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r29203195 = x;
        double r29203196 = y;
        double r29203197 = r29203195 * r29203196;
        double r29203198 = z;
        double r29203199 = 9.0;
        double r29203200 = r29203198 * r29203199;
        double r29203201 = t;
        double r29203202 = r29203200 * r29203201;
        double r29203203 = r29203197 - r29203202;
        double r29203204 = a;
        double r29203205 = 2.0;
        double r29203206 = r29203204 * r29203205;
        double r29203207 = r29203203 / r29203206;
        return r29203207;
}

double f(double x, double y, double z, double t, double a) {
        double r29203208 = t;
        double r29203209 = -9.31236613093365e+24;
        bool r29203210 = r29203208 <= r29203209;
        double r29203211 = x;
        double r29203212 = y;
        double r29203213 = r29203211 * r29203212;
        double r29203214 = a;
        double r29203215 = r29203213 / r29203214;
        double r29203216 = 0.5;
        double r29203217 = r29203215 * r29203216;
        double r29203218 = 4.5;
        double r29203219 = z;
        double r29203220 = r29203219 / r29203214;
        double r29203221 = r29203220 * r29203208;
        double r29203222 = r29203218 * r29203221;
        double r29203223 = r29203217 - r29203222;
        double r29203224 = 819283338.3549674;
        bool r29203225 = r29203208 <= r29203224;
        double r29203226 = 1.0;
        double r29203227 = r29203226 / r29203214;
        double r29203228 = 9.0;
        double r29203229 = r29203208 * r29203228;
        double r29203230 = r29203229 * r29203219;
        double r29203231 = r29203213 - r29203230;
        double r29203232 = 2.0;
        double r29203233 = r29203231 / r29203232;
        double r29203234 = r29203227 * r29203233;
        double r29203235 = cbrt(r29203214);
        double r29203236 = r29203219 / r29203235;
        double r29203237 = r29203235 * r29203235;
        double r29203238 = r29203208 / r29203237;
        double r29203239 = r29203236 * r29203238;
        double r29203240 = r29203218 * r29203239;
        double r29203241 = r29203217 - r29203240;
        double r29203242 = r29203225 ? r29203234 : r29203241;
        double r29203243 = r29203210 ? r29203223 : r29203242;
        return r29203243;
}

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
Target6.0
Herbie6.1
\[\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 t < -9.31236613093365e+24

    1. Initial program 13.5

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

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

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

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

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

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

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

    if -9.31236613093365e+24 < t < 819283338.3549674

    1. Initial program 4.4

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

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

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

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

    if 819283338.3549674 < t

    1. Initial program 12.5

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt12.9

      \[\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}}}\]
    9. Applied times-frac8.1

      \[\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)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -9312366130933649759010816:\\ \;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{elif}\;t \le 819283338.3549673557281494140625:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - \left(t \cdot 9\right) \cdot z}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - 4.5 \cdot \left(\frac{z}{\sqrt[3]{a}} \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(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)))