Average Error: 15.8 → 10.4
Time: 16.0s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -3.882750870169282 \cdot 10^{+54}:\\ \;\;\;\;x + \left(y - \left(y \cdot \frac{1}{a - t}\right) \cdot \left(z - t\right)\right)\\ \mathbf{elif}\;t \le 5.8516997634450565 \cdot 10^{+103}:\\ \;\;\;\;x + \left(y - \frac{\left(z - t\right) \cdot y}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -3.882750870169282 \cdot 10^{+54}:\\
\;\;\;\;x + \left(y - \left(y \cdot \frac{1}{a - t}\right) \cdot \left(z - t\right)\right)\\

\mathbf{elif}\;t \le 5.8516997634450565 \cdot 10^{+103}:\\
\;\;\;\;x + \left(y - \frac{\left(z - t\right) \cdot y}{a - t}\right)\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r27553939 = x;
        double r27553940 = y;
        double r27553941 = r27553939 + r27553940;
        double r27553942 = z;
        double r27553943 = t;
        double r27553944 = r27553942 - r27553943;
        double r27553945 = r27553944 * r27553940;
        double r27553946 = a;
        double r27553947 = r27553946 - r27553943;
        double r27553948 = r27553945 / r27553947;
        double r27553949 = r27553941 - r27553948;
        return r27553949;
}

double f(double x, double y, double z, double t, double a) {
        double r27553950 = t;
        double r27553951 = -3.882750870169282e+54;
        bool r27553952 = r27553950 <= r27553951;
        double r27553953 = x;
        double r27553954 = y;
        double r27553955 = 1.0;
        double r27553956 = a;
        double r27553957 = r27553956 - r27553950;
        double r27553958 = r27553955 / r27553957;
        double r27553959 = r27553954 * r27553958;
        double r27553960 = z;
        double r27553961 = r27553960 - r27553950;
        double r27553962 = r27553959 * r27553961;
        double r27553963 = r27553954 - r27553962;
        double r27553964 = r27553953 + r27553963;
        double r27553965 = 5.8516997634450565e+103;
        bool r27553966 = r27553950 <= r27553965;
        double r27553967 = r27553961 * r27553954;
        double r27553968 = r27553967 / r27553957;
        double r27553969 = r27553954 - r27553968;
        double r27553970 = r27553953 + r27553969;
        double r27553971 = r27553954 * r27553960;
        double r27553972 = r27553971 / r27553950;
        double r27553973 = r27553953 + r27553972;
        double r27553974 = r27553966 ? r27553970 : r27553973;
        double r27553975 = r27553952 ? r27553964 : r27553974;
        return r27553975;
}

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

Original15.8
Target8.3
Herbie10.4
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.3664970889390727 \cdot 10^{-07}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \mathbf{elif}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt 1.4754293444577233 \cdot 10^{-239}:\\ \;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -3.882750870169282e+54

    1. Initial program 26.7

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

      \[\leadsto \color{blue}{x + \left(y - \frac{\left(z - t\right) \cdot y}{a - t}\right)}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity22.7

      \[\leadsto x + \left(y - \frac{\left(z - t\right) \cdot y}{\color{blue}{1 \cdot \left(a - t\right)}}\right)\]
    6. Applied times-frac12.7

      \[\leadsto x + \left(y - \color{blue}{\frac{z - t}{1} \cdot \frac{y}{a - t}}\right)\]
    7. Simplified12.7

      \[\leadsto x + \left(y - \color{blue}{\left(z - t\right)} \cdot \frac{y}{a - t}\right)\]
    8. Using strategy rm
    9. Applied div-inv13.8

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

    if -3.882750870169282e+54 < t < 5.8516997634450565e+103

    1. Initial program 7.6

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

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

    if 5.8516997634450565e+103 < t

    1. Initial program 30.7

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

      \[\leadsto \color{blue}{x + \left(y - \frac{\left(z - t\right) \cdot y}{a - t}\right)}\]
    4. Taylor expanded around inf 18.3

      \[\leadsto x + \color{blue}{\frac{z \cdot y}{t}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -3.882750870169282 \cdot 10^{+54}:\\ \;\;\;\;x + \left(y - \left(y \cdot \frac{1}{a - t}\right) \cdot \left(z - t\right)\right)\\ \mathbf{elif}\;t \le 5.8516997634450565 \cdot 10^{+103}:\\ \;\;\;\;x + \left(y - \frac{\left(z - t\right) \cdot y}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2019162 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"

  :herbie-target
  (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-07) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y))))

  (- (+ x y) (/ (* (- z t) y) (- a t))))