Average Error: 16.5 → 8.6
Time: 20.4s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.109009211274608548546199935798657041585 \cdot 10^{-28} \lor \neg \left(a \le 2.260376857285187509777510471893509100313 \cdot 10^{-175}\right):\\ \;\;\;\;x + \left(y - \left(z - t\right) \cdot \frac{y}{a - 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 -1.109009211274608548546199935798657041585 \cdot 10^{-28} \lor \neg \left(a \le 2.260376857285187509777510471893509100313 \cdot 10^{-175}\right):\\
\;\;\;\;x + \left(y - \left(z - t\right) \cdot \frac{y}{a - 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 r427554 = x;
        double r427555 = y;
        double r427556 = r427554 + r427555;
        double r427557 = z;
        double r427558 = t;
        double r427559 = r427557 - r427558;
        double r427560 = r427559 * r427555;
        double r427561 = a;
        double r427562 = r427561 - r427558;
        double r427563 = r427560 / r427562;
        double r427564 = r427556 - r427563;
        return r427564;
}

double f(double x, double y, double z, double t, double a) {
        double r427565 = a;
        double r427566 = -1.1090092112746085e-28;
        bool r427567 = r427565 <= r427566;
        double r427568 = 2.2603768572851875e-175;
        bool r427569 = r427565 <= r427568;
        double r427570 = !r427569;
        bool r427571 = r427567 || r427570;
        double r427572 = x;
        double r427573 = y;
        double r427574 = z;
        double r427575 = t;
        double r427576 = r427574 - r427575;
        double r427577 = r427565 - r427575;
        double r427578 = r427573 / r427577;
        double r427579 = r427576 * r427578;
        double r427580 = r427573 - r427579;
        double r427581 = r427572 + r427580;
        double r427582 = r427574 * r427573;
        double r427583 = r427582 / r427575;
        double r427584 = r427583 + r427572;
        double r427585 = r427571 ? r427581 : r427584;
        return r427585;
}

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.5
Target8.3
Herbie8.6
\[\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 < -1.1090092112746085e-28 or 2.2603768572851875e-175 < a

    1. Initial program 15.0

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity15.0

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

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

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

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

    if -1.1090092112746085e-28 < a < 2.2603768572851875e-175

    1. Initial program 19.8

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

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

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

Reproduce

herbie shell --seed 2019323 
(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))))