Average Error: 16.5 → 8.6
Time: 22.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}:\\ \;\;\;\;\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 r495065 = x;
        double r495066 = y;
        double r495067 = r495065 + r495066;
        double r495068 = z;
        double r495069 = t;
        double r495070 = r495068 - r495069;
        double r495071 = r495070 * r495066;
        double r495072 = a;
        double r495073 = r495072 - r495069;
        double r495074 = r495071 / r495073;
        double r495075 = r495067 - r495074;
        return r495075;
}

double f(double x, double y, double z, double t, double a) {
        double r495076 = a;
        double r495077 = -1.1090092112746085e-28;
        bool r495078 = r495076 <= r495077;
        double r495079 = 2.2603768572851875e-175;
        bool r495080 = r495076 <= r495079;
        double r495081 = !r495080;
        bool r495082 = r495078 || r495081;
        double r495083 = x;
        double r495084 = y;
        double r495085 = z;
        double r495086 = t;
        double r495087 = r495085 - r495086;
        double r495088 = r495076 - r495086;
        double r495089 = r495084 / r495088;
        double r495090 = r495087 * r495089;
        double r495091 = r495084 - r495090;
        double r495092 = r495083 + r495091;
        double r495093 = r495085 * r495084;
        double r495094 = r495093 / r495086;
        double r495095 = r495094 + r495083;
        double r495096 = r495082 ? r495092 : r495095;
        return r495096;
}

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