Average Error: 7.9 → 4.3
Time: 10.8s
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 = -\infty:\\ \;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 0.0:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 3.861757416987853855034265396917964327938 \cdot 10^{208}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - t \cdot \left(4.5 \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 = -\infty:\\
\;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r747672 = x;
        double r747673 = y;
        double r747674 = r747672 * r747673;
        double r747675 = z;
        double r747676 = 9.0;
        double r747677 = r747675 * r747676;
        double r747678 = t;
        double r747679 = r747677 * r747678;
        double r747680 = r747674 - r747679;
        double r747681 = a;
        double r747682 = 2.0;
        double r747683 = r747681 * r747682;
        double r747684 = r747680 / r747683;
        return r747684;
}

double f(double x, double y, double z, double t, double a) {
        double r747685 = z;
        double r747686 = 9.0;
        double r747687 = r747685 * r747686;
        double r747688 = t;
        double r747689 = r747687 * r747688;
        double r747690 = -inf.0;
        bool r747691 = r747689 <= r747690;
        double r747692 = 0.5;
        double r747693 = x;
        double r747694 = a;
        double r747695 = r747693 / r747694;
        double r747696 = 1.0;
        double r747697 = y;
        double r747698 = r747696 / r747697;
        double r747699 = r747695 / r747698;
        double r747700 = r747692 * r747699;
        double r747701 = 4.5;
        double r747702 = r747688 * r747701;
        double r747703 = r747685 / r747694;
        double r747704 = r747702 * r747703;
        double r747705 = r747700 - r747704;
        double r747706 = 0.0;
        bool r747707 = r747689 <= r747706;
        double r747708 = r747697 / r747694;
        double r747709 = r747693 * r747708;
        double r747710 = r747692 * r747709;
        double r747711 = r747688 * r747685;
        double r747712 = r747711 / r747694;
        double r747713 = r747701 * r747712;
        double r747714 = r747710 - r747713;
        double r747715 = 3.861757416987854e+208;
        bool r747716 = r747689 <= r747715;
        double r747717 = r747693 * r747697;
        double r747718 = r747686 * r747688;
        double r747719 = r747685 * r747718;
        double r747720 = r747717 - r747719;
        double r747721 = 2.0;
        double r747722 = r747694 * r747721;
        double r747723 = r747720 / r747722;
        double r747724 = r747694 / r747697;
        double r747725 = r747693 / r747724;
        double r747726 = r747692 * r747725;
        double r747727 = r747701 * r747703;
        double r747728 = r747688 * r747727;
        double r747729 = r747726 - r747728;
        double r747730 = r747716 ? r747723 : r747729;
        double r747731 = r747707 ? r747714 : r747730;
        double r747732 = r747691 ? r747705 : r747731;
        return r747732;
}

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.9
Target5.6
Herbie4.3
\[\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 (* (* z 9.0) t) < -inf.0

    1. Initial program 64.0

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity63.0

      \[\leadsto 0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{\color{blue}{1 \cdot a}}\]
    7. Applied times-frac0.3

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

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

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

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

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

    if -inf.0 < (* (* z 9.0) t) < 0.0

    1. Initial program 4.3

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

      \[\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-identity4.2

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

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

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

    if 0.0 < (* (* z 9.0) t) < 3.861757416987854e+208

    1. Initial program 4.3

      \[\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}\]

    if 3.861757416987854e+208 < (* (* z 9.0) t)

    1. Initial program 31.3

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

      \[\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*27.5

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity27.5

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t = -\infty:\\ \;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 0.0:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 3.861757416987853855034265396917964327938 \cdot 10^{208}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - t \cdot \left(4.5 \cdot \frac{z}{a}\right)\\ \end{array}\]

Reproduce

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