Average Error: 7.9 → 0.9
Time: 16.7s
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 -1.427431772388590456353738345747557666006 \cdot 10^{270}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.016237879537753043850615344011243625605 \cdot 10^{232}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(4.5 \cdot \frac{t}{a}\right) \cdot z\\ \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 -1.427431772388590456353738345747557666006 \cdot 10^{270}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r516963 = x;
        double r516964 = y;
        double r516965 = r516963 * r516964;
        double r516966 = z;
        double r516967 = 9.0;
        double r516968 = r516966 * r516967;
        double r516969 = t;
        double r516970 = r516968 * r516969;
        double r516971 = r516965 - r516970;
        double r516972 = a;
        double r516973 = 2.0;
        double r516974 = r516972 * r516973;
        double r516975 = r516971 / r516974;
        return r516975;
}

double f(double x, double y, double z, double t, double a) {
        double r516976 = x;
        double r516977 = y;
        double r516978 = r516976 * r516977;
        double r516979 = z;
        double r516980 = 9.0;
        double r516981 = r516979 * r516980;
        double r516982 = t;
        double r516983 = r516981 * r516982;
        double r516984 = r516978 - r516983;
        double r516985 = -1.4274317723885905e+270;
        bool r516986 = r516984 <= r516985;
        double r516987 = 0.5;
        double r516988 = a;
        double r516989 = r516988 / r516977;
        double r516990 = r516976 / r516989;
        double r516991 = r516987 * r516990;
        double r516992 = 4.5;
        double r516993 = r516979 / r516988;
        double r516994 = r516982 * r516993;
        double r516995 = r516992 * r516994;
        double r516996 = r516991 - r516995;
        double r516997 = 2.016237879537753e+232;
        bool r516998 = r516984 <= r516997;
        double r516999 = 1.0;
        double r517000 = r516999 / r516988;
        double r517001 = 2.0;
        double r517002 = r516984 / r517001;
        double r517003 = r517000 * r517002;
        double r517004 = r516982 / r516988;
        double r517005 = r516992 * r517004;
        double r517006 = r517005 * r516979;
        double r517007 = r516991 - r517006;
        double r517008 = r516998 ? r517003 : r517007;
        double r517009 = r516986 ? r516996 : r517008;
        return r517009;
}

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.7
Herbie0.9
\[\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 (- (* x y) (* (* z 9.0) t)) < -1.4274317723885905e+270

    1. Initial program 46.5

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\]
    5. Using strategy rm
    6. Applied associate-/l*0.6

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t}{\frac{a}{z}}\]
    7. Using strategy rm
    8. Applied div-inv0.6

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

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

    if -1.4274317723885905e+270 < (- (* x y) (* (* z 9.0) t)) < 2.016237879537753e+232

    1. Initial program 0.8

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

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)}}{a \cdot 2}\]
    4. Applied times-frac0.9

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

    if 2.016237879537753e+232 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 34.4

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\]
    5. Using strategy rm
    6. Applied associate-/l*0.6

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

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

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

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

Reproduce

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