Average Error: 7.6 → 4.0
Time: 7.1s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -2.21834298495767539 \cdot 10^{236}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.3603949856993749 \cdot 10^{34}:\\ \;\;\;\;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 2.9090994917840058 \cdot 10^{187}:\\ \;\;\;\;\left(x \cdot y - \left(9 \cdot t\right) \cdot z\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 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 \le -2.21834298495767539 \cdot 10^{236}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;x \cdot y \le -1.3603949856993749 \cdot 10^{34}:\\
\;\;\;\;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 2.9090994917840058 \cdot 10^{187}:\\
\;\;\;\;\left(x \cdot y - \left(9 \cdot t\right) \cdot z\right) \cdot \frac{1}{a \cdot 2}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r264318 = x;
        double r264319 = y;
        double r264320 = r264318 * r264319;
        double r264321 = z;
        double r264322 = 9.0;
        double r264323 = r264321 * r264322;
        double r264324 = t;
        double r264325 = r264323 * r264324;
        double r264326 = r264320 - r264325;
        double r264327 = a;
        double r264328 = 2.0;
        double r264329 = r264327 * r264328;
        double r264330 = r264326 / r264329;
        return r264330;
}

double f(double x, double y, double z, double t, double a) {
        double r264331 = x;
        double r264332 = y;
        double r264333 = r264331 * r264332;
        double r264334 = -2.2183429849576754e+236;
        bool r264335 = r264333 <= r264334;
        double r264336 = 0.5;
        double r264337 = a;
        double r264338 = r264337 / r264332;
        double r264339 = r264331 / r264338;
        double r264340 = r264336 * r264339;
        double r264341 = 4.5;
        double r264342 = t;
        double r264343 = z;
        double r264344 = r264342 * r264343;
        double r264345 = r264344 / r264337;
        double r264346 = r264341 * r264345;
        double r264347 = r264340 - r264346;
        double r264348 = -1.360394985699375e+34;
        bool r264349 = r264333 <= r264348;
        double r264350 = r264333 / r264337;
        double r264351 = r264336 * r264350;
        double r264352 = cbrt(r264337);
        double r264353 = r264352 * r264352;
        double r264354 = r264342 / r264353;
        double r264355 = r264341 * r264354;
        double r264356 = r264343 / r264352;
        double r264357 = r264355 * r264356;
        double r264358 = r264351 - r264357;
        double r264359 = 2.9090994917840058e+187;
        bool r264360 = r264333 <= r264359;
        double r264361 = 9.0;
        double r264362 = r264361 * r264342;
        double r264363 = r264362 * r264343;
        double r264364 = r264333 - r264363;
        double r264365 = 1.0;
        double r264366 = 2.0;
        double r264367 = r264337 * r264366;
        double r264368 = r264365 / r264367;
        double r264369 = r264364 * r264368;
        double r264370 = r264360 ? r264369 : r264347;
        double r264371 = r264349 ? r264358 : r264370;
        double r264372 = r264335 ? r264347 : r264371;
        return r264372;
}

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.6
Target5.6
Herbie4.0
\[\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.14403070783397609 \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) < -2.2183429849576754e+236 or 2.9090994917840058e+187 < (* x y)

    1. Initial program 31.3

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

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

    if -2.2183429849576754e+236 < (* x y) < -1.360394985699375e+34

    1. Initial program 5.1

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

      \[\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-frac2.0

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

      \[\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 -1.360394985699375e+34 < (* x y) < 2.9090994917840058e+187

    1. Initial program 3.9

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

      \[\leadsto \frac{\color{blue}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}{a \cdot 2}\]
    3. Using strategy rm
    4. Applied div-inv3.9

      \[\leadsto \color{blue}{\left(x \cdot y - 9 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a \cdot 2}}\]
    5. Using strategy rm
    6. Applied associate-*r*4.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -2.21834298495767539 \cdot 10^{236}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.3603949856993749 \cdot 10^{34}:\\ \;\;\;\;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 2.9090994917840058 \cdot 10^{187}:\\ \;\;\;\;\left(x \cdot y - \left(9 \cdot t\right) \cdot z\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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