Average Error: 7.8 → 5.0
Time: 22.5s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t = -\infty:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 714062.429749303148:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{\left(4.5 \cdot t\right) \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 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}\;\left(z \cdot 9\right) \cdot t = -\infty:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\

\mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 714062.429749303148:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{\left(4.5 \cdot t\right) \cdot z}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r536026 = x;
        double r536027 = y;
        double r536028 = r536026 * r536027;
        double r536029 = z;
        double r536030 = 9.0;
        double r536031 = r536029 * r536030;
        double r536032 = t;
        double r536033 = r536031 * r536032;
        double r536034 = r536028 - r536033;
        double r536035 = a;
        double r536036 = 2.0;
        double r536037 = r536035 * r536036;
        double r536038 = r536034 / r536037;
        return r536038;
}

double f(double x, double y, double z, double t, double a) {
        double r536039 = z;
        double r536040 = 9.0;
        double r536041 = r536039 * r536040;
        double r536042 = t;
        double r536043 = r536041 * r536042;
        double r536044 = -inf.0;
        bool r536045 = r536043 <= r536044;
        double r536046 = 0.5;
        double r536047 = x;
        double r536048 = y;
        double r536049 = r536047 * r536048;
        double r536050 = a;
        double r536051 = r536049 / r536050;
        double r536052 = r536046 * r536051;
        double r536053 = 4.5;
        double r536054 = r536053 * r536042;
        double r536055 = r536039 / r536050;
        double r536056 = r536054 * r536055;
        double r536057 = r536052 - r536056;
        double r536058 = 714062.4297493031;
        bool r536059 = r536043 <= r536058;
        double r536060 = r536054 * r536039;
        double r536061 = r536060 / r536050;
        double r536062 = r536052 - r536061;
        double r536063 = r536048 / r536050;
        double r536064 = r536047 * r536063;
        double r536065 = r536046 * r536064;
        double r536066 = r536050 / r536039;
        double r536067 = r536042 / r536066;
        double r536068 = r536053 * r536067;
        double r536069 = r536065 - r536068;
        double r536070 = r536059 ? r536062 : r536069;
        double r536071 = r536045 ? r536057 : r536070;
        return r536071;
}

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.8
Target5.4
Herbie5.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 (* (* z 9.0) t) < -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 63.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 *-un-lft-identity63.1

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

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

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

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

    if -inf.0 < (* (* z 9.0) t) < 714062.4297493031

    1. Initial program 4.3

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

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

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

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

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

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

    if 714062.4297493031 < (* (* z 9.0) t)

    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.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*10.0

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

      \[\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.6

      \[\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.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t = -\infty:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 714062.429749303148:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{\left(4.5 \cdot t\right) \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019198 +o rules:numerics
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"

  :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.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))