Average Error: 7.9 → 4.3
Time: 19.1s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;a \cdot 2 \le -28791852422410342598396870656:\\ \;\;\;\;\sqrt{0.5} \cdot \left(\sqrt{0.5} \cdot \left(x \cdot \frac{y}{a}\right)\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le 4.481142187418851386305353735697248598535 \cdot 10^{79}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - \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}\;a \cdot 2 \le -28791852422410342598396870656:\\
\;\;\;\;\sqrt{0.5} \cdot \left(\sqrt{0.5} \cdot \left(x \cdot \frac{y}{a}\right)\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - \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 r468890 = x;
        double r468891 = y;
        double r468892 = r468890 * r468891;
        double r468893 = z;
        double r468894 = 9.0;
        double r468895 = r468893 * r468894;
        double r468896 = t;
        double r468897 = r468895 * r468896;
        double r468898 = r468892 - r468897;
        double r468899 = a;
        double r468900 = 2.0;
        double r468901 = r468899 * r468900;
        double r468902 = r468898 / r468901;
        return r468902;
}

double f(double x, double y, double z, double t, double a) {
        double r468903 = a;
        double r468904 = 2.0;
        double r468905 = r468903 * r468904;
        double r468906 = -2.8791852422410343e+28;
        bool r468907 = r468905 <= r468906;
        double r468908 = 0.5;
        double r468909 = sqrt(r468908);
        double r468910 = x;
        double r468911 = y;
        double r468912 = r468911 / r468903;
        double r468913 = r468910 * r468912;
        double r468914 = r468909 * r468913;
        double r468915 = r468909 * r468914;
        double r468916 = 4.5;
        double r468917 = t;
        double r468918 = z;
        double r468919 = r468903 / r468918;
        double r468920 = r468917 / r468919;
        double r468921 = r468916 * r468920;
        double r468922 = r468915 - r468921;
        double r468923 = 4.4811421874188514e+79;
        bool r468924 = r468905 <= r468923;
        double r468925 = r468910 * r468911;
        double r468926 = 9.0;
        double r468927 = r468926 * r468917;
        double r468928 = r468918 * r468927;
        double r468929 = r468925 - r468928;
        double r468930 = r468929 / r468905;
        double r468931 = r468908 * r468913;
        double r468932 = r468917 / r468903;
        double r468933 = r468916 * r468932;
        double r468934 = r468933 * r468918;
        double r468935 = r468931 - r468934;
        double r468936 = r468924 ? r468930 : r468935;
        double r468937 = r468907 ? r468922 : r468936;
        return r468937;
}

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.8
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 3 regimes
  2. if (* a 2.0) < -2.8791852422410343e+28

    1. Initial program 12.7

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

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

      \[\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 *-un-lft-identity10.1

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

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

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

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

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

    if -2.8791852422410343e+28 < (* a 2.0) < 4.4811421874188514e+79

    1. Initial program 2.0

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

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

    if 4.4811421874188514e+79 < (* a 2.0)

    1. Initial program 13.2

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

      \[\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 *-un-lft-identity11.2

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \le -28791852422410342598396870656:\\ \;\;\;\;\sqrt{0.5} \cdot \left(\sqrt{0.5} \cdot \left(x \cdot \frac{y}{a}\right)\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le 4.481142187418851386305353735697248598535 \cdot 10^{79}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - \left(4.5 \cdot \frac{t}{a}\right) \cdot z\\ \end{array}\]

Reproduce

herbie shell --seed 2019303 +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.090464557976709e86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.14403070783397609e99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9) t)) (* a 2)))