Average Error: 7.9 → 0.6
Time: 17.9s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -7.176900408502955352877377596419789607004 \cdot 10^{212}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.328488004665020601912433058328595852611 \cdot 10^{-172} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.395800868589944224912154246744742554327 \cdot 10^{-238} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 1.357521776657596255493501226834911842863 \cdot 10^{232}\right)\right):\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -7.176900408502955352877377596419789607004 \cdot 10^{212}:\\
\;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\

\mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.328488004665020601912433058328595852611 \cdot 10^{-172} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.395800868589944224912154246744742554327 \cdot 10^{-238} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 1.357521776657596255493501226834911842863 \cdot 10^{232}\right)\right):\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r609453 = x;
        double r609454 = y;
        double r609455 = r609453 * r609454;
        double r609456 = z;
        double r609457 = 9.0;
        double r609458 = r609456 * r609457;
        double r609459 = t;
        double r609460 = r609458 * r609459;
        double r609461 = r609455 - r609460;
        double r609462 = a;
        double r609463 = 2.0;
        double r609464 = r609462 * r609463;
        double r609465 = r609461 / r609464;
        return r609465;
}

double f(double x, double y, double z, double t, double a) {
        double r609466 = x;
        double r609467 = y;
        double r609468 = r609466 * r609467;
        double r609469 = z;
        double r609470 = 9.0;
        double r609471 = r609469 * r609470;
        double r609472 = t;
        double r609473 = r609471 * r609472;
        double r609474 = r609468 - r609473;
        double r609475 = -7.176900408502955e+212;
        bool r609476 = r609474 <= r609475;
        double r609477 = 0.5;
        double r609478 = r609477 * r609466;
        double r609479 = a;
        double r609480 = r609467 / r609479;
        double r609481 = r609478 * r609480;
        double r609482 = 4.5;
        double r609483 = r609482 * r609472;
        double r609484 = r609469 / r609479;
        double r609485 = r609483 * r609484;
        double r609486 = r609481 - r609485;
        double r609487 = -8.328488004665021e-172;
        bool r609488 = r609474 <= r609487;
        double r609489 = 3.395800868589944e-238;
        bool r609490 = r609474 <= r609489;
        double r609491 = 1.3575217766575963e+232;
        bool r609492 = r609474 <= r609491;
        double r609493 = !r609492;
        bool r609494 = r609490 || r609493;
        double r609495 = !r609494;
        bool r609496 = r609488 || r609495;
        double r609497 = r609472 * r609470;
        double r609498 = r609469 * r609497;
        double r609499 = r609468 - r609498;
        double r609500 = 2.0;
        double r609501 = r609479 * r609500;
        double r609502 = r609499 / r609501;
        double r609503 = r609479 / r609469;
        double r609504 = r609472 / r609503;
        double r609505 = r609482 * r609504;
        double r609506 = r609481 - r609505;
        double r609507 = r609496 ? r609502 : r609506;
        double r609508 = r609476 ? r609486 : r609507;
        return r609508;
}

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.9
Target5.6
Herbie0.6
\[\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) (* (* z 9.0) t)) < -7.176900408502955e+212

    1. Initial program 31.8

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

      \[\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-identity31.6

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

      \[\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*16.9

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

      \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity16.9

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

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

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

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

    if -7.176900408502955e+212 < (- (* x y) (* (* z 9.0) t)) < -8.328488004665021e-172 or 3.395800868589944e-238 < (- (* x y) (* (* z 9.0) t)) < 1.3575217766575963e+232

    1. Initial program 0.3

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

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

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

    if -8.328488004665021e-172 < (- (* x y) (* (* z 9.0) t)) < 3.395800868589944e-238 or 1.3575217766575963e+232 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 23.4

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 23.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-identity23.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-frac13.0

      \[\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*13.0

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

      \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\]
    8. Using strategy rm
    9. Applied associate-/l*1.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -7.176900408502955352877377596419789607004 \cdot 10^{212}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.328488004665020601912433058328595852611 \cdot 10^{-172} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.395800868589944224912154246744742554327 \cdot 10^{-238} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 1.357521776657596255493501226834911842863 \cdot 10^{232}\right)\right):\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019305 
(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)))