Average Error: 16.8 → 11.0
Time: 18.6s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -6.6057660298985682 \cdot 10^{137}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \mathbf{elif}\;t \le 4.2840164135106727 \cdot 10^{-5}:\\ \;\;\;\;x + \left(y - \frac{\left(z - t\right) \cdot y}{a - t}\right)\\ \mathbf{elif}\;t \le 2.1017965543309036 \cdot 10^{103}:\\ \;\;\;\;\left(x + y\right) - \frac{z - t}{\frac{a - t}{y}}\\ \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}\;t \le -6.6057660298985682 \cdot 10^{137}:\\
\;\;\;\;\frac{z \cdot y}{t} + x\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r590290 = x;
        double r590291 = y;
        double r590292 = r590290 + r590291;
        double r590293 = z;
        double r590294 = t;
        double r590295 = r590293 - r590294;
        double r590296 = r590295 * r590291;
        double r590297 = a;
        double r590298 = r590297 - r590294;
        double r590299 = r590296 / r590298;
        double r590300 = r590292 - r590299;
        return r590300;
}

double f(double x, double y, double z, double t, double a) {
        double r590301 = t;
        double r590302 = -6.605766029898568e+137;
        bool r590303 = r590301 <= r590302;
        double r590304 = z;
        double r590305 = y;
        double r590306 = r590304 * r590305;
        double r590307 = r590306 / r590301;
        double r590308 = x;
        double r590309 = r590307 + r590308;
        double r590310 = 4.284016413510673e-05;
        bool r590311 = r590301 <= r590310;
        double r590312 = r590304 - r590301;
        double r590313 = r590312 * r590305;
        double r590314 = a;
        double r590315 = r590314 - r590301;
        double r590316 = r590313 / r590315;
        double r590317 = r590305 - r590316;
        double r590318 = r590308 + r590317;
        double r590319 = 2.1017965543309036e+103;
        bool r590320 = r590301 <= r590319;
        double r590321 = r590308 + r590305;
        double r590322 = r590315 / r590305;
        double r590323 = r590312 / r590322;
        double r590324 = r590321 - r590323;
        double r590325 = r590320 ? r590324 : r590309;
        double r590326 = r590311 ? r590318 : r590325;
        double r590327 = r590303 ? r590309 : r590326;
        return r590327;
}

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.8
Target8.6
Herbie11.0
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.3664970889390727 \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.47542934445772333 \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 < -6.605766029898568e+137 or 2.1017965543309036e+103 < t

    1. Initial program 32.3

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Taylor expanded around inf 17.1

      \[\leadsto \color{blue}{\frac{z \cdot y}{t} + x}\]

    if -6.605766029898568e+137 < t < 4.284016413510673e-05

    1. Initial program 8.5

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

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

    if 4.284016413510673e-05 < t < 2.1017965543309036e+103

    1. Initial program 14.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -6.6057660298985682 \cdot 10^{137}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \mathbf{elif}\;t \le 4.2840164135106727 \cdot 10^{-5}:\\ \;\;\;\;x + \left(y - \frac{\left(z - t\right) \cdot y}{a - t}\right)\\ \mathbf{elif}\;t \le 2.1017965543309036 \cdot 10^{103}:\\ \;\;\;\;\left(x + y\right) - \frac{z - t}{\frac{a - t}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot y}{t} + x\\ \end{array}\]

Reproduce

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

  :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))))