Average Error: 7.5 → 4.5
Time: 3.2s
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 -5.335969994093865341214242464393616714808 \cdot 10^{212}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 1.784597876851625989292363127933133697877 \cdot 10^{154}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z}{\frac{a \cdot 2}{9 \cdot t}}\\ \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 -5.335969994093865341214242464393616714808 \cdot 10^{212}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z}{\frac{a \cdot 2}{9 \cdot t}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r782287 = x;
        double r782288 = y;
        double r782289 = r782287 * r782288;
        double r782290 = z;
        double r782291 = 9.0;
        double r782292 = r782290 * r782291;
        double r782293 = t;
        double r782294 = r782292 * r782293;
        double r782295 = r782289 - r782294;
        double r782296 = a;
        double r782297 = 2.0;
        double r782298 = r782296 * r782297;
        double r782299 = r782295 / r782298;
        return r782299;
}

double f(double x, double y, double z, double t, double a) {
        double r782300 = z;
        double r782301 = 9.0;
        double r782302 = r782300 * r782301;
        double r782303 = t;
        double r782304 = r782302 * r782303;
        double r782305 = -5.335969994093865e+212;
        bool r782306 = r782304 <= r782305;
        double r782307 = x;
        double r782308 = y;
        double r782309 = r782307 * r782308;
        double r782310 = a;
        double r782311 = 2.0;
        double r782312 = r782310 * r782311;
        double r782313 = r782309 / r782312;
        double r782314 = r782302 / r782310;
        double r782315 = r782303 / r782311;
        double r782316 = r782314 * r782315;
        double r782317 = r782313 - r782316;
        double r782318 = 1.784597876851626e+154;
        bool r782319 = r782304 <= r782318;
        double r782320 = r782304 / r782312;
        double r782321 = r782313 - r782320;
        double r782322 = r782301 * r782303;
        double r782323 = r782312 / r782322;
        double r782324 = r782300 / r782323;
        double r782325 = r782313 - r782324;
        double r782326 = r782319 ? r782321 : r782325;
        double r782327 = r782306 ? r782317 : r782326;
        return r782327;
}

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.6
Herbie4.5
\[\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 (* (* z 9.0) t) < -5.335969994093865e+212

    1. Initial program 30.8

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied associate-*l*30.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-sub30.8

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

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \frac{\color{blue}{\left(z \cdot 9\right) \cdot t}}{a \cdot 2}\]
    8. Using strategy rm
    9. Applied times-frac5.2

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

    if -5.335969994093865e+212 < (* (* z 9.0) t) < 1.784597876851626e+154

    1. Initial program 4.2

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

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

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

    if 1.784597876851626e+154 < (* (* z 9.0) t)

    1. Initial program 22.8

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied associate-*l*22.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-sub22.8

      \[\leadsto \color{blue}{\frac{x \cdot y}{a \cdot 2} - \frac{z \cdot \left(9 \cdot t\right)}{a \cdot 2}}\]
    6. Using strategy rm
    7. Applied associate-/l*6.7

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \color{blue}{\frac{z}{\frac{a \cdot 2}{9 \cdot t}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification4.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t \le -5.335969994093865341214242464393616714808 \cdot 10^{212}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 1.784597876851625989292363127933133697877 \cdot 10^{154}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z}{\frac{a \cdot 2}{9 \cdot t}}\\ \end{array}\]

Reproduce

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