Average Error: 7.5 → 6.1
Time: 15.5s
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 -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le -2.351629294748413366835826341287596823597 \cdot 10^{-14}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;a \cdot 2 \le 4.940347943794864332566063191313488771801 \cdot 10^{-102}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}\\ \mathbf{elif}\;a \cdot 2 \le 6.077447378939868238265068590780103982245 \cdot 10^{221}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \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}\;a \cdot 2 \le -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;a \cdot 2 \le -2.351629294748413366835826341287596823597 \cdot 10^{-14}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\

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

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

\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 r494652 = x;
        double r494653 = y;
        double r494654 = r494652 * r494653;
        double r494655 = z;
        double r494656 = 9.0;
        double r494657 = r494655 * r494656;
        double r494658 = t;
        double r494659 = r494657 * r494658;
        double r494660 = r494654 - r494659;
        double r494661 = a;
        double r494662 = 2.0;
        double r494663 = r494661 * r494662;
        double r494664 = r494660 / r494663;
        return r494664;
}

double f(double x, double y, double z, double t, double a) {
        double r494665 = a;
        double r494666 = 2.0;
        double r494667 = r494665 * r494666;
        double r494668 = -5.526614624971197e+247;
        bool r494669 = r494667 <= r494668;
        double r494670 = 0.5;
        double r494671 = x;
        double r494672 = y;
        double r494673 = r494671 * r494672;
        double r494674 = r494673 / r494665;
        double r494675 = r494670 * r494674;
        double r494676 = 4.5;
        double r494677 = t;
        double r494678 = z;
        double r494679 = r494665 / r494678;
        double r494680 = r494677 / r494679;
        double r494681 = r494676 * r494680;
        double r494682 = r494675 - r494681;
        double r494683 = -2.3516292947484134e-14;
        bool r494684 = r494667 <= r494683;
        double r494685 = r494672 / r494665;
        double r494686 = r494671 * r494685;
        double r494687 = r494670 * r494686;
        double r494688 = r494677 * r494678;
        double r494689 = r494688 / r494665;
        double r494690 = r494676 * r494689;
        double r494691 = r494687 - r494690;
        double r494692 = 4.940347943794864e-102;
        bool r494693 = r494667 <= r494692;
        double r494694 = 1.0;
        double r494695 = 9.0;
        double r494696 = r494678 * r494695;
        double r494697 = r494696 * r494677;
        double r494698 = r494673 - r494697;
        double r494699 = r494667 / r494698;
        double r494700 = r494694 / r494699;
        double r494701 = 6.077447378939868e+221;
        bool r494702 = r494667 <= r494701;
        double r494703 = r494665 / r494672;
        double r494704 = r494671 / r494703;
        double r494705 = r494670 * r494704;
        double r494706 = r494705 - r494690;
        double r494707 = r494702 ? r494682 : r494706;
        double r494708 = r494693 ? r494700 : r494707;
        double r494709 = r494684 ? r494691 : r494708;
        double r494710 = r494669 ? r494682 : r494709;
        return r494710;
}

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
Herbie6.1
\[\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 (* a 2.0) < -5.526614624971197e+247 or 4.940347943794864e-102 < (* a 2.0) < 6.077447378939868e+221

    1. Initial program 8.1

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

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

    if -5.526614624971197e+247 < (* a 2.0) < -2.3516292947484134e-14

    1. Initial program 9.6

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

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

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

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

    if -2.3516292947484134e-14 < (* a 2.0) < 4.940347943794864e-102

    1. Initial program 1.8

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

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

    if 6.077447378939868e+221 < (* a 2.0)

    1. Initial program 15.2

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 14.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 associate-/l*11.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 simplification6.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \le -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le -2.351629294748413366835826341287596823597 \cdot 10^{-14}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;a \cdot 2 \le 4.940347943794864332566063191313488771801 \cdot 10^{-102}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}\\ \mathbf{elif}\;a \cdot 2 \le 6.077447378939868238265068590780103982245 \cdot 10^{221}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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