Average Error: 16.2 → 9.2
Time: 5.1s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -8.04642291642522 \cdot 10^{-175} \lor \neg \left(a \le 2.05454744875226964 \cdot 10^{-112}\right):\\ \;\;\;\;\left(x + y\right) - \left(z - t\right) \cdot \frac{y}{a - t}\\ \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 -8.04642291642522 \cdot 10^{-175} \lor \neg \left(a \le 2.05454744875226964 \cdot 10^{-112}\right):\\
\;\;\;\;\left(x + y\right) - \left(z - t\right) \cdot \frac{y}{a - t}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r627447 = x;
        double r627448 = y;
        double r627449 = r627447 + r627448;
        double r627450 = z;
        double r627451 = t;
        double r627452 = r627450 - r627451;
        double r627453 = r627452 * r627448;
        double r627454 = a;
        double r627455 = r627454 - r627451;
        double r627456 = r627453 / r627455;
        double r627457 = r627449 - r627456;
        return r627457;
}

double f(double x, double y, double z, double t, double a) {
        double r627458 = a;
        double r627459 = -8.04642291642522e-175;
        bool r627460 = r627458 <= r627459;
        double r627461 = 2.0545474487522696e-112;
        bool r627462 = r627458 <= r627461;
        double r627463 = !r627462;
        bool r627464 = r627460 || r627463;
        double r627465 = x;
        double r627466 = y;
        double r627467 = r627465 + r627466;
        double r627468 = z;
        double r627469 = t;
        double r627470 = r627468 - r627469;
        double r627471 = r627458 - r627469;
        double r627472 = r627466 / r627471;
        double r627473 = r627470 * r627472;
        double r627474 = r627467 - r627473;
        double r627475 = r627468 * r627466;
        double r627476 = r627475 / r627469;
        double r627477 = r627476 + r627465;
        double r627478 = r627464 ? r627474 : r627477;
        return r627478;
}

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.2
Target8.1
Herbie9.2
\[\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 2 regimes
  2. if a < -8.04642291642522e-175 or 2.0545474487522696e-112 < a

    1. Initial program 14.6

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

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

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

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

    if -8.04642291642522e-175 < a < 2.0545474487522696e-112

    1. Initial program 21.2

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

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

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

Reproduce

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