Average Error: 7.5 → 6.1
Time: 17.3s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;a \cdot 2 \le -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le -1.42264071494389898098327431764394710599 \cdot 10^{-30}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;a \cdot 2 \le 4.940347943794864332566063191313488771801 \cdot 10^{-102}:\\ \;\;\;\;\left(x \cdot y - z \cdot \left(9 \cdot t\right)\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{elif}\;a \cdot 2 \le 6.077447378939868238265068590780103982245 \cdot 10^{221}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \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}\;a \cdot 2 \le -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

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

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

\mathbf{elif}\;a \cdot 2 \le 6.077447378939868238265068590780103982245 \cdot 10^{221}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\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 r490505 = x;
        double r490506 = y;
        double r490507 = r490505 * r490506;
        double r490508 = z;
        double r490509 = 9.0;
        double r490510 = r490508 * r490509;
        double r490511 = t;
        double r490512 = r490510 * r490511;
        double r490513 = r490507 - r490512;
        double r490514 = a;
        double r490515 = 2.0;
        double r490516 = r490514 * r490515;
        double r490517 = r490513 / r490516;
        return r490517;
}

double f(double x, double y, double z, double t, double a) {
        double r490518 = a;
        double r490519 = 2.0;
        double r490520 = r490518 * r490519;
        double r490521 = -5.526614624971197e+247;
        bool r490522 = r490520 <= r490521;
        double r490523 = 0.5;
        double r490524 = x;
        double r490525 = y;
        double r490526 = r490524 * r490525;
        double r490527 = r490526 / r490518;
        double r490528 = r490523 * r490527;
        double r490529 = 4.5;
        double r490530 = t;
        double r490531 = z;
        double r490532 = r490518 / r490531;
        double r490533 = r490530 / r490532;
        double r490534 = r490529 * r490533;
        double r490535 = r490528 - r490534;
        double r490536 = -1.422640714943899e-30;
        bool r490537 = r490520 <= r490536;
        double r490538 = r490525 / r490518;
        double r490539 = r490524 * r490538;
        double r490540 = r490523 * r490539;
        double r490541 = r490530 * r490531;
        double r490542 = r490541 / r490518;
        double r490543 = r490529 * r490542;
        double r490544 = r490540 - r490543;
        double r490545 = 4.940347943794864e-102;
        bool r490546 = r490520 <= r490545;
        double r490547 = 9.0;
        double r490548 = r490547 * r490530;
        double r490549 = r490531 * r490548;
        double r490550 = r490526 - r490549;
        double r490551 = 1.0;
        double r490552 = r490551 / r490520;
        double r490553 = r490550 * r490552;
        double r490554 = 6.077447378939868e+221;
        bool r490555 = r490520 <= r490554;
        double r490556 = r490518 / r490525;
        double r490557 = r490524 / r490556;
        double r490558 = r490523 * r490557;
        double r490559 = r490558 - r490543;
        double r490560 = r490555 ? r490535 : r490559;
        double r490561 = r490546 ? r490553 : r490560;
        double r490562 = r490537 ? r490544 : r490561;
        double r490563 = r490522 ? r490535 : r490562;
        return r490563;
}

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.5
Target5.5
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 4 regimes
  2. if (* a 2.0) < -5.526614624971197e+247 or 4.940347943794864e-102 < (* a 2.0) < 6.077447378939868e+221

    1. Initial program 8.1

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

    if -5.526614624971197e+247 < (* a 2.0) < -1.422640714943899e-30

    1. Initial program 9.2

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

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

    if -1.422640714943899e-30 < (* a 2.0) < 4.940347943794864e-102

    1. Initial program 1.9

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

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

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

    if 6.077447378939868e+221 < (* a 2.0)

    1. Initial program 15.2

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \le -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le -1.42264071494389898098327431764394710599 \cdot 10^{-30}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;a \cdot 2 \le 4.940347943794864332566063191313488771801 \cdot 10^{-102}:\\ \;\;\;\;\left(x \cdot y - z \cdot \left(9 \cdot t\right)\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{elif}\;a \cdot 2 \le 6.077447378939868238265068590780103982245 \cdot 10^{221}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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