Average Error: 8.0 → 4.5
Time: 4.0s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t \le -9.85021245226496752 \cdot 10^{257}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le -1.6867079506036999 \cdot 10^{-91}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 2.2438109332373993 \cdot 10^{-237}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 1.1637209329558432 \cdot 10^{-135}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 2.89152344327594563 \cdot 10^{209}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;\left(z \cdot 9\right) \cdot t \le -9.85021245226496752 \cdot 10^{257}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\

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

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r726489 = x;
        double r726490 = y;
        double r726491 = r726489 * r726490;
        double r726492 = z;
        double r726493 = 9.0;
        double r726494 = r726492 * r726493;
        double r726495 = t;
        double r726496 = r726494 * r726495;
        double r726497 = r726491 - r726496;
        double r726498 = a;
        double r726499 = 2.0;
        double r726500 = r726498 * r726499;
        double r726501 = r726497 / r726500;
        return r726501;
}

double f(double x, double y, double z, double t, double a) {
        double r726502 = z;
        double r726503 = 9.0;
        double r726504 = r726502 * r726503;
        double r726505 = t;
        double r726506 = r726504 * r726505;
        double r726507 = -9.850212452264968e+257;
        bool r726508 = r726506 <= r726507;
        double r726509 = 0.5;
        double r726510 = x;
        double r726511 = y;
        double r726512 = r726510 * r726511;
        double r726513 = a;
        double r726514 = r726512 / r726513;
        double r726515 = r726509 * r726514;
        double r726516 = 4.5;
        double r726517 = r726502 / r726513;
        double r726518 = r726505 * r726517;
        double r726519 = r726516 * r726518;
        double r726520 = r726515 - r726519;
        double r726521 = -1.6867079506037e-91;
        bool r726522 = r726506 <= r726521;
        double r726523 = r726513 / r726511;
        double r726524 = r726510 / r726523;
        double r726525 = r726509 * r726524;
        double r726526 = r726505 * r726502;
        double r726527 = r726526 / r726513;
        double r726528 = r726516 * r726527;
        double r726529 = r726525 - r726528;
        double r726530 = 2.2438109332373993e-237;
        bool r726531 = r726506 <= r726530;
        double r726532 = r726516 * r726526;
        double r726533 = 1.0;
        double r726534 = r726533 / r726513;
        double r726535 = r726532 * r726534;
        double r726536 = r726515 - r726535;
        double r726537 = 1.1637209329558432e-135;
        bool r726538 = r726506 <= r726537;
        double r726539 = r726511 / r726513;
        double r726540 = r726510 * r726539;
        double r726541 = r726509 * r726540;
        double r726542 = r726541 - r726535;
        double r726543 = 2.8915234432759456e+209;
        bool r726544 = r726506 <= r726543;
        double r726545 = r726544 ? r726536 : r726520;
        double r726546 = r726538 ? r726542 : r726545;
        double r726547 = r726531 ? r726536 : r726546;
        double r726548 = r726522 ? r726529 : r726547;
        double r726549 = r726508 ? r726520 : r726548;
        return r726549;
}

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.5
Herbie4.5
\[\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 4 regimes
  2. if (* (* z 9.0) t) < -9.850212452264968e+257 or 2.8915234432759456e+209 < (* (* z 9.0) t)

    1. Initial program 37.4

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

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

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

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

    if -9.850212452264968e+257 < (* (* z 9.0) t) < -1.6867079506037e-91

    1. Initial program 4.0

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

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

    if -1.6867079506037e-91 < (* (* z 9.0) t) < 2.2438109332373993e-237 or 1.1637209329558432e-135 < (* (* z 9.0) t) < 2.8915234432759456e+209

    1. Initial program 4.4

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

      \[\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 div-inv4.5

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

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

    if 2.2438109332373993e-237 < (* (* z 9.0) t) < 1.1637209329558432e-135

    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.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 div-inv3.9

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t \le -9.85021245226496752 \cdot 10^{257}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le -1.6867079506036999 \cdot 10^{-91}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 2.2438109332373993 \cdot 10^{-237}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 1.1637209329558432 \cdot 10^{-135}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 2.89152344327594563 \cdot 10^{209}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array}\]

Reproduce

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