Average Error: 15.8 → 10.4
Time: 13.8s
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 r29363706 = x;
        double r29363707 = y;
        double r29363708 = r29363706 + r29363707;
        double r29363709 = z;
        double r29363710 = t;
        double r29363711 = r29363709 - r29363710;
        double r29363712 = r29363711 * r29363707;
        double r29363713 = a;
        double r29363714 = r29363713 - r29363710;
        double r29363715 = r29363712 / r29363714;
        double r29363716 = r29363708 - r29363715;
        return r29363716;
}

double f(double x, double y, double z, double t, double a) {
        double r29363717 = t;
        double r29363718 = -3.882750870169282e+54;
        bool r29363719 = r29363717 <= r29363718;
        double r29363720 = x;
        double r29363721 = y;
        double r29363722 = 1.0;
        double r29363723 = a;
        double r29363724 = r29363723 - r29363717;
        double r29363725 = r29363722 / r29363724;
        double r29363726 = r29363721 * r29363725;
        double r29363727 = z;
        double r29363728 = r29363727 - r29363717;
        double r29363729 = r29363726 * r29363728;
        double r29363730 = r29363721 - r29363729;
        double r29363731 = r29363720 + r29363730;
        double r29363732 = 5.8516997634450565e+103;
        bool r29363733 = r29363717 <= r29363732;
        double r29363734 = r29363728 * r29363721;
        double r29363735 = r29363734 / r29363724;
        double r29363736 = r29363721 - r29363735;
        double r29363737 = r29363720 + r29363736;
        double r29363738 = r29363721 * r29363727;
        double r29363739 = r29363738 / r29363717;
        double r29363740 = r29363720 + r29363739;
        double r29363741 = r29363733 ? r29363737 : r29363740;
        double r29363742 = r29363719 ? r29363731 : r29363741;
        return r29363742;
}

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. Using strategy rm
    5. Applied *-un-lft-identity26.7

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

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

      \[\leadsto x + \left(y - \color{blue}{\left(z - t\right)} \cdot \frac{y}{a - t}\right)\]
    8. 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))))