Average Error: 16.3 → 6.7
Time: 19.0s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.672792571764071954889367114208945902284 \cdot 10^{-138} \lor \neg \left(a \le 2.196290821956725546139870832505024501091 \cdot 10^{-167}\right):\\ \;\;\;\;x + \left(y - \frac{y}{\frac{a - t}{z - t}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -2.672792571764071954889367114208945902284 \cdot 10^{-138} \lor \neg \left(a \le 2.196290821956725546139870832505024501091 \cdot 10^{-167}\right):\\
\;\;\;\;x + \left(y - \frac{y}{\frac{a - t}{z - t}}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r497974 = x;
        double r497975 = y;
        double r497976 = r497974 + r497975;
        double r497977 = z;
        double r497978 = t;
        double r497979 = r497977 - r497978;
        double r497980 = r497979 * r497975;
        double r497981 = a;
        double r497982 = r497981 - r497978;
        double r497983 = r497980 / r497982;
        double r497984 = r497976 - r497983;
        return r497984;
}

double f(double x, double y, double z, double t, double a) {
        double r497985 = a;
        double r497986 = -2.672792571764072e-138;
        bool r497987 = r497985 <= r497986;
        double r497988 = 2.1962908219567255e-167;
        bool r497989 = r497985 <= r497988;
        double r497990 = !r497989;
        bool r497991 = r497987 || r497990;
        double r497992 = x;
        double r497993 = y;
        double r497994 = t;
        double r497995 = r497985 - r497994;
        double r497996 = z;
        double r497997 = r497996 - r497994;
        double r497998 = r497995 / r497997;
        double r497999 = r497993 / r497998;
        double r498000 = r497993 - r497999;
        double r498001 = r497992 + r498000;
        double r498002 = r497996 * r497993;
        double r498003 = r498002 / r497994;
        double r498004 = r498003 + r497992;
        double r498005 = r497991 ? r498001 : r498004;
        return r498005;
}

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

Original16.3
Target8.6
Herbie6.7
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.366497088939072697550672266103566343531 \cdot 10^{-7}:\\ \;\;\;\;\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.475429344457723334351036314450840066235 \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 2 regimes
  2. if a < -2.672792571764072e-138 or 2.1962908219567255e-167 < a

    1. Initial program 15.0

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Simplified15.0

      \[\leadsto \color{blue}{\left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t}}\]
    3. Using strategy rm
    4. Applied associate--l+13.6

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

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

    if -2.672792571764072e-138 < a < 2.1962908219567255e-167

    1. Initial program 20.5

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Simplified20.5

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

      \[\leadsto \color{blue}{\frac{z \cdot y}{t} + x}\]
    4. Simplified9.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.672792571764071954889367114208945902284 \cdot 10^{-138} \lor \neg \left(a \le 2.196290821956725546139870832505024501091 \cdot 10^{-167}\right):\\ \;\;\;\;x + \left(y - \frac{y}{\frac{a - t}{z - t}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019196 
(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.0 (- 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.0 (- a t))) y))))

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