Average Error: 7.7 → 4.3
Time: 16.5s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -2.325399801639216975878730762048415990222 \cdot 10^{-108}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le 5.162788372782689888027473257955766052666 \cdot 10^{-319}:\\ \;\;\;\;0.5 \cdot \left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 2.006042602196822974594038209112314781323 \cdot 10^{-82}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le 9.067555230001552688088291073346960474377 \cdot 10^{283}:\\ \;\;\;\;\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) - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;x \cdot y \le -2.325399801639216975878730762048415990222 \cdot 10^{-108}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\

\mathbf{elif}\;x \cdot y \le 5.162788372782689888027473257955766052666 \cdot 10^{-319}:\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;x \cdot y \le 2.006042602196822974594038209112314781323 \cdot 10^{-82}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\

\mathbf{elif}\;x \cdot y \le 9.067555230001552688088291073346960474377 \cdot 10^{283}:\\
\;\;\;\;\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) - 4.5 \cdot \frac{t \cdot z}{a}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r496018 = x;
        double r496019 = y;
        double r496020 = r496018 * r496019;
        double r496021 = z;
        double r496022 = 9.0;
        double r496023 = r496021 * r496022;
        double r496024 = t;
        double r496025 = r496023 * r496024;
        double r496026 = r496020 - r496025;
        double r496027 = a;
        double r496028 = 2.0;
        double r496029 = r496027 * r496028;
        double r496030 = r496026 / r496029;
        return r496030;
}

double f(double x, double y, double z, double t, double a) {
        double r496031 = x;
        double r496032 = y;
        double r496033 = r496031 * r496032;
        double r496034 = -inf.0;
        bool r496035 = r496033 <= r496034;
        double r496036 = 0.5;
        double r496037 = a;
        double r496038 = r496037 / r496032;
        double r496039 = r496031 / r496038;
        double r496040 = r496036 * r496039;
        double r496041 = 4.5;
        double r496042 = t;
        double r496043 = z;
        double r496044 = r496042 * r496043;
        double r496045 = r496044 / r496037;
        double r496046 = r496041 * r496045;
        double r496047 = r496040 - r496046;
        double r496048 = -2.325399801639217e-108;
        bool r496049 = r496033 <= r496048;
        double r496050 = r496033 / r496037;
        double r496051 = r496036 * r496050;
        double r496052 = cbrt(r496037);
        double r496053 = r496052 * r496052;
        double r496054 = r496042 / r496053;
        double r496055 = r496041 * r496054;
        double r496056 = r496043 / r496052;
        double r496057 = r496055 * r496056;
        double r496058 = r496051 - r496057;
        double r496059 = 5.1627883727827e-319;
        bool r496060 = r496033 <= r496059;
        double r496061 = r496031 / r496053;
        double r496062 = r496032 / r496052;
        double r496063 = r496061 * r496062;
        double r496064 = r496036 * r496063;
        double r496065 = r496064 - r496046;
        double r496066 = 2.006042602196823e-82;
        bool r496067 = r496033 <= r496066;
        double r496068 = 9.067555230001553e+283;
        bool r496069 = r496033 <= r496068;
        double r496070 = 9.0;
        double r496071 = r496070 * r496042;
        double r496072 = r496043 * r496071;
        double r496073 = r496033 - r496072;
        double r496074 = 2.0;
        double r496075 = r496037 * r496074;
        double r496076 = r496073 / r496075;
        double r496077 = r496032 / r496037;
        double r496078 = r496031 * r496077;
        double r496079 = r496036 * r496078;
        double r496080 = r496079 - r496046;
        double r496081 = r496069 ? r496076 : r496080;
        double r496082 = r496067 ? r496058 : r496081;
        double r496083 = r496060 ? r496065 : r496082;
        double r496084 = r496049 ? r496058 : r496083;
        double r496085 = r496035 ? r496047 : r496084;
        return r496085;
}

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.7
Target5.4
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 5 regimes
  2. if (* x y) < -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 64.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*7.0

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

    if -inf.0 < (* x y) < -2.325399801639217e-108 or 5.1627883727827e-319 < (* x y) < 2.006042602196823e-82

    1. Initial program 3.9

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    5. Applied times-frac3.7

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

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

    if -2.325399801639217e-108 < (* x y) < 5.1627883727827e-319

    1. Initial program 5.1

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Applied times-frac5.0

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

    if 2.006042602196823e-82 < (* x y) < 9.067555230001553e+283

    1. Initial program 4.0

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

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

    if 9.067555230001553e+283 < (* x y)

    1. Initial program 52.9

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

      \[\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-identity52.9

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{\color{blue}{1 \cdot a}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Applied times-frac6.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. Simplified6.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -2.325399801639216975878730762048415990222 \cdot 10^{-108}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le 5.162788372782689888027473257955766052666 \cdot 10^{-319}:\\ \;\;\;\;0.5 \cdot \left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 2.006042602196822974594038209112314781323 \cdot 10^{-82}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le 9.067555230001552688088291073346960474377 \cdot 10^{283}:\\ \;\;\;\;\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) - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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