Average Error: 8.1 → 1.4
Time: 4.3s
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 -9.55879104644502299 \cdot 10^{207}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.16138642467709393 \cdot 10^{149}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - 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}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -9.55879104644502299 \cdot 10^{207}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - 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 r659482 = x;
        double r659483 = y;
        double r659484 = r659482 * r659483;
        double r659485 = z;
        double r659486 = 9.0;
        double r659487 = r659485 * r659486;
        double r659488 = t;
        double r659489 = r659487 * r659488;
        double r659490 = r659484 - r659489;
        double r659491 = a;
        double r659492 = 2.0;
        double r659493 = r659491 * r659492;
        double r659494 = r659490 / r659493;
        return r659494;
}

double f(double x, double y, double z, double t, double a) {
        double r659495 = x;
        double r659496 = y;
        double r659497 = r659495 * r659496;
        double r659498 = z;
        double r659499 = 9.0;
        double r659500 = r659498 * r659499;
        double r659501 = t;
        double r659502 = r659500 * r659501;
        double r659503 = r659497 - r659502;
        double r659504 = -9.558791046445023e+207;
        bool r659505 = r659503 <= r659504;
        double r659506 = 0.5;
        double r659507 = a;
        double r659508 = r659507 / r659496;
        double r659509 = r659495 / r659508;
        double r659510 = r659506 * r659509;
        double r659511 = 4.5;
        double r659512 = r659511 * r659501;
        double r659513 = r659498 / r659507;
        double r659514 = r659512 * r659513;
        double r659515 = r659510 - r659514;
        double r659516 = 2.161386424677094e+149;
        bool r659517 = r659503 <= r659516;
        double r659518 = r659497 / r659507;
        double r659519 = r659506 * r659518;
        double r659520 = r659501 * r659498;
        double r659521 = r659511 * r659520;
        double r659522 = r659521 / r659507;
        double r659523 = r659519 - r659522;
        double r659524 = r659495 / r659507;
        double r659525 = 1.0;
        double r659526 = r659525 / r659496;
        double r659527 = r659524 / r659526;
        double r659528 = r659506 * r659527;
        double r659529 = r659501 * r659513;
        double r659530 = r659511 * r659529;
        double r659531 = r659528 - r659530;
        double r659532 = r659517 ? r659523 : r659531;
        double r659533 = r659505 ? r659515 : r659532;
        return r659533;
}

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.1
Target5.9
Herbie1.4
\[\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 3 regimes
  2. if (- (* x y) (* (* z 9.0) t)) < -9.558791046445023e+207

    1. Initial program 30.1

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

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

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

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

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

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

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

    if -9.558791046445023e+207 < (- (* x y) (* (* z 9.0) t)) < 2.161386424677094e+149

    1. Initial program 1.0

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

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

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

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\frac{t \cdot z}{a}}\]
    9. Applied associate-*r/1.0

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

    if 2.161386424677094e+149 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 21.5

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

      \[\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-identity21.3

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -9.55879104644502299 \cdot 10^{207}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.16138642467709393 \cdot 10^{149}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020039 +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)))