Average Error: 8.0 → 1.1
Time: 52.9s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9.0\right) \cdot t \le -1.5506240475436017 \cdot 10^{+275}:\\ \;\;\;\;\frac{x}{2.0} \cdot \frac{y}{a} - \frac{z}{a} \cdot \frac{t \cdot 9.0}{2.0}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9.0\right) \cdot t \le 1.242329322710186 \cdot 10^{+161}:\\ \;\;\;\;\frac{\frac{x \cdot y - \left(t \cdot 9.0\right) \cdot z}{a}}{2.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2.0} \cdot \frac{y}{a} - \frac{z}{a} \cdot \frac{t \cdot 9.0}{2.0}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}
\begin{array}{l}
\mathbf{if}\;x \cdot y - \left(z \cdot 9.0\right) \cdot t \le -1.5506240475436017 \cdot 10^{+275}:\\
\;\;\;\;\frac{x}{2.0} \cdot \frac{y}{a} - \frac{z}{a} \cdot \frac{t \cdot 9.0}{2.0}\\

\mathbf{elif}\;x \cdot y - \left(z \cdot 9.0\right) \cdot t \le 1.242329322710186 \cdot 10^{+161}:\\
\;\;\;\;\frac{\frac{x \cdot y - \left(t \cdot 9.0\right) \cdot z}{a}}{2.0}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{2.0} \cdot \frac{y}{a} - \frac{z}{a} \cdot \frac{t \cdot 9.0}{2.0}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r34357360 = x;
        double r34357361 = y;
        double r34357362 = r34357360 * r34357361;
        double r34357363 = z;
        double r34357364 = 9.0;
        double r34357365 = r34357363 * r34357364;
        double r34357366 = t;
        double r34357367 = r34357365 * r34357366;
        double r34357368 = r34357362 - r34357367;
        double r34357369 = a;
        double r34357370 = 2.0;
        double r34357371 = r34357369 * r34357370;
        double r34357372 = r34357368 / r34357371;
        return r34357372;
}

double f(double x, double y, double z, double t, double a) {
        double r34357373 = x;
        double r34357374 = y;
        double r34357375 = r34357373 * r34357374;
        double r34357376 = z;
        double r34357377 = 9.0;
        double r34357378 = r34357376 * r34357377;
        double r34357379 = t;
        double r34357380 = r34357378 * r34357379;
        double r34357381 = r34357375 - r34357380;
        double r34357382 = -1.5506240475436017e+275;
        bool r34357383 = r34357381 <= r34357382;
        double r34357384 = 2.0;
        double r34357385 = r34357373 / r34357384;
        double r34357386 = a;
        double r34357387 = r34357374 / r34357386;
        double r34357388 = r34357385 * r34357387;
        double r34357389 = r34357376 / r34357386;
        double r34357390 = r34357379 * r34357377;
        double r34357391 = r34357390 / r34357384;
        double r34357392 = r34357389 * r34357391;
        double r34357393 = r34357388 - r34357392;
        double r34357394 = 1.242329322710186e+161;
        bool r34357395 = r34357381 <= r34357394;
        double r34357396 = r34357390 * r34357376;
        double r34357397 = r34357375 - r34357396;
        double r34357398 = r34357397 / r34357386;
        double r34357399 = r34357398 / r34357384;
        double r34357400 = r34357395 ? r34357399 : r34357393;
        double r34357401 = r34357383 ? r34357393 : r34357400;
        return r34357401;
}

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.8
Herbie1.1
\[\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.144030707833976 \cdot 10^{+99}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9.0 \cdot t\right)}{a \cdot 2.0}\\ \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 2 regimes
  2. if (- (* x y) (* (* z 9.0) t)) < -1.5506240475436017e+275 or 1.242329322710186e+161 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 32.0

      \[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity32.0

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y - \left(z \cdot 9.0\right) \cdot t\right)}}{a \cdot 2.0}\]
    4. Applied times-frac32.0

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{2.0}}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt32.4

      \[\leadsto \frac{1}{a} \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{\color{blue}{\sqrt{2.0} \cdot \sqrt{2.0}}}\]
    7. Applied *-un-lft-identity32.4

      \[\leadsto \frac{1}{a} \cdot \frac{\color{blue}{1 \cdot \left(x \cdot y - \left(z \cdot 9.0\right) \cdot t\right)}}{\sqrt{2.0} \cdot \sqrt{2.0}}\]
    8. Applied times-frac32.3

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(\frac{1}{\sqrt{2.0}} \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{\sqrt{2.0}}\right)}\]
    9. Applied associate-*r*32.3

      \[\leadsto \color{blue}{\left(\frac{1}{a} \cdot \frac{1}{\sqrt{2.0}}\right) \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{\sqrt{2.0}}}\]
    10. Simplified32.2

      \[\leadsto \color{blue}{\frac{\frac{1}{a}}{\sqrt{2.0}}} \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{\sqrt{2.0}}\]
    11. Taylor expanded around inf 32.2

      \[\leadsto \color{blue}{\frac{x \cdot y}{{\left(\sqrt{2.0}\right)}^{2} \cdot a} - 9.0 \cdot \frac{t \cdot z}{{\left(\sqrt{2.0}\right)}^{2} \cdot a}}\]
    12. Simplified2.0

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

    if -1.5506240475436017e+275 < (- (* x y) (* (* z 9.0) t)) < 1.242329322710186e+161

    1. Initial program 0.9

      \[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.9

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y - \left(z \cdot 9.0\right) \cdot t\right)}}{a \cdot 2.0}\]
    4. Applied times-frac1.0

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{2.0}}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt1.6

      \[\leadsto \frac{1}{a} \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{\color{blue}{\sqrt{2.0} \cdot \sqrt{2.0}}}\]
    7. Applied *-un-lft-identity1.6

      \[\leadsto \frac{1}{a} \cdot \frac{\color{blue}{1 \cdot \left(x \cdot y - \left(z \cdot 9.0\right) \cdot t\right)}}{\sqrt{2.0} \cdot \sqrt{2.0}}\]
    8. Applied times-frac1.5

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(\frac{1}{\sqrt{2.0}} \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{\sqrt{2.0}}\right)}\]
    9. Applied associate-*r*1.4

      \[\leadsto \color{blue}{\left(\frac{1}{a} \cdot \frac{1}{\sqrt{2.0}}\right) \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{\sqrt{2.0}}}\]
    10. Simplified1.3

      \[\leadsto \color{blue}{\frac{\frac{1}{a}}{\sqrt{2.0}}} \cdot \frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{\sqrt{2.0}}\]
    11. Using strategy rm
    12. Applied frac-times1.7

      \[\leadsto \color{blue}{\frac{\frac{1}{a} \cdot \left(x \cdot y - \left(z \cdot 9.0\right) \cdot t\right)}{\sqrt{2.0} \cdot \sqrt{2.0}}}\]
    13. Simplified1.7

      \[\leadsto \frac{\color{blue}{\frac{y \cdot x - z \cdot \left(9.0 \cdot t\right)}{a}}}{\sqrt{2.0} \cdot \sqrt{2.0}}\]
    14. Simplified0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9.0\right) \cdot t \le -1.5506240475436017 \cdot 10^{+275}:\\ \;\;\;\;\frac{x}{2.0} \cdot \frac{y}{a} - \frac{z}{a} \cdot \frac{t \cdot 9.0}{2.0}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9.0\right) \cdot t \le 1.242329322710186 \cdot 10^{+161}:\\ \;\;\;\;\frac{\frac{x \cdot y - \left(t \cdot 9.0\right) \cdot z}{a}}{2.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2.0} \cdot \frac{y}{a} - \frac{z}{a} \cdot \frac{t \cdot 9.0}{2.0}\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"

  :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.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))