Average Error: 16.5 → 8.6
Time: 21.0s
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}:\\ \;\;\;\;x + \frac{z \cdot y}{t}\\ \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}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r462508 = x;
        double r462509 = y;
        double r462510 = r462508 + r462509;
        double r462511 = z;
        double r462512 = t;
        double r462513 = r462511 - r462512;
        double r462514 = r462513 * r462509;
        double r462515 = a;
        double r462516 = r462515 - r462512;
        double r462517 = r462514 / r462516;
        double r462518 = r462510 - r462517;
        return r462518;
}

double f(double x, double y, double z, double t, double a) {
        double r462519 = a;
        double r462520 = -1.1090092112746085e-28;
        bool r462521 = r462519 <= r462520;
        double r462522 = 2.2603768572851875e-175;
        bool r462523 = r462519 <= r462522;
        double r462524 = !r462523;
        bool r462525 = r462521 || r462524;
        double r462526 = x;
        double r462527 = y;
        double r462528 = z;
        double r462529 = t;
        double r462530 = r462528 - r462529;
        double r462531 = r462519 - r462529;
        double r462532 = r462527 / r462531;
        double r462533 = r462530 * r462532;
        double r462534 = r462527 - r462533;
        double r462535 = r462526 + r462534;
        double r462536 = r462528 * r462527;
        double r462537 = r462536 / r462529;
        double r462538 = r462526 + r462537;
        double r462539 = r462525 ? r462535 : r462538;
        return r462539;
}

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. Using strategy rm
    3. Applied *-un-lft-identity19.8

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

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

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

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

      \[\leadsto x + \color{blue}{\frac{z \cdot y}{t}}\]
  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}:\\ \;\;\;\;x + \frac{z \cdot y}{t}\\ \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))))