Average Error: 7.5 → 7.0
Time: 10.7s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;t \le -4.64302300476199321253936141201088047645 \cdot 10^{207}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;t \le -6.801574407066787372684693751538154161399 \cdot 10^{-169}:\\ \;\;\;\;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}\;t \le 3.896589267953642908457651205208862823512 \cdot 10^{-160}:\\ \;\;\;\;\frac{x \cdot y - \left(t \cdot z\right) \cdot 9}{a \cdot 2}\\ \mathbf{elif}\;t \le 1.74458846292638704396335680813129906484 \cdot 10^{144}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;t \le -4.64302300476199321253936141201088047645 \cdot 10^{207}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;t \le -6.801574407066787372684693751538154161399 \cdot 10^{-169}:\\
\;\;\;\;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}\;t \le 3.896589267953642908457651205208862823512 \cdot 10^{-160}:\\
\;\;\;\;\frac{x \cdot y - \left(t \cdot z\right) \cdot 9}{a \cdot 2}\\

\mathbf{elif}\;t \le 1.74458846292638704396335680813129906484 \cdot 10^{144}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r633540 = x;
        double r633541 = y;
        double r633542 = r633540 * r633541;
        double r633543 = z;
        double r633544 = 9.0;
        double r633545 = r633543 * r633544;
        double r633546 = t;
        double r633547 = r633545 * r633546;
        double r633548 = r633542 - r633547;
        double r633549 = a;
        double r633550 = 2.0;
        double r633551 = r633549 * r633550;
        double r633552 = r633548 / r633551;
        return r633552;
}

double f(double x, double y, double z, double t, double a) {
        double r633553 = t;
        double r633554 = -4.643023004761993e+207;
        bool r633555 = r633553 <= r633554;
        double r633556 = 0.5;
        double r633557 = x;
        double r633558 = y;
        double r633559 = r633557 * r633558;
        double r633560 = a;
        double r633561 = r633559 / r633560;
        double r633562 = r633556 * r633561;
        double r633563 = 4.5;
        double r633564 = z;
        double r633565 = r633560 / r633564;
        double r633566 = r633553 / r633565;
        double r633567 = r633563 * r633566;
        double r633568 = r633562 - r633567;
        double r633569 = -6.801574407066787e-169;
        bool r633570 = r633553 <= r633569;
        double r633571 = cbrt(r633560);
        double r633572 = r633571 * r633571;
        double r633573 = r633557 / r633572;
        double r633574 = r633558 / r633571;
        double r633575 = r633573 * r633574;
        double r633576 = r633556 * r633575;
        double r633577 = r633553 * r633564;
        double r633578 = r633577 / r633560;
        double r633579 = r633563 * r633578;
        double r633580 = r633576 - r633579;
        double r633581 = 3.896589267953643e-160;
        bool r633582 = r633553 <= r633581;
        double r633583 = 9.0;
        double r633584 = r633577 * r633583;
        double r633585 = r633559 - r633584;
        double r633586 = 2.0;
        double r633587 = r633560 * r633586;
        double r633588 = r633585 / r633587;
        double r633589 = 1.744588462926387e+144;
        bool r633590 = r633553 <= r633589;
        double r633591 = r633560 / r633558;
        double r633592 = r633557 / r633591;
        double r633593 = r633556 * r633592;
        double r633594 = r633593 - r633579;
        double r633595 = r633590 ? r633594 : r633568;
        double r633596 = r633582 ? r633588 : r633595;
        double r633597 = r633570 ? r633580 : r633596;
        double r633598 = r633555 ? r633568 : r633597;
        return r633598;
}

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.5
Target5.5
Herbie7.0
\[\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 t < -4.643023004761993e+207 or 1.744588462926387e+144 < t

    1. Initial program 16.1

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

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

    if -4.643023004761993e+207 < t < -6.801574407066787e-169

    1. Initial program 7.2

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

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

      \[\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 -6.801574407066787e-169 < t < 3.896589267953643e-160

    1. Initial program 4.5

      \[\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}\]
    4. Taylor expanded around 0 4.4

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

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

    if 3.896589267953643e-160 < t < 1.744588462926387e+144

    1. Initial program 5.5

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

      \[\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}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.64302300476199321253936141201088047645 \cdot 10^{207}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;t \le -6.801574407066787372684693751538154161399 \cdot 10^{-169}:\\ \;\;\;\;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}\;t \le 3.896589267953642908457651205208862823512 \cdot 10^{-160}:\\ \;\;\;\;\frac{x \cdot y - \left(t \cdot z\right) \cdot 9}{a \cdot 2}\\ \mathbf{elif}\;t \le 1.74458846292638704396335680813129906484 \cdot 10^{144}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019351 +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.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)))