Average Error: 2.0 → 1.8
Time: 12.2s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.47437460621894122515597907358401131123 \cdot 10^{-73}:\\ \;\;\;\;x - z \cdot \left(\frac{x}{t} - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;z \le -1.47437460621894122515597907358401131123 \cdot 10^{-73}:\\
\;\;\;\;x - z \cdot \left(\frac{x}{t} - \frac{y}{t}\right)\\

\mathbf{else}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r340104 = x;
        double r340105 = y;
        double r340106 = r340105 - r340104;
        double r340107 = z;
        double r340108 = t;
        double r340109 = r340107 / r340108;
        double r340110 = r340106 * r340109;
        double r340111 = r340104 + r340110;
        return r340111;
}

double f(double x, double y, double z, double t) {
        double r340112 = z;
        double r340113 = -1.4743746062189412e-73;
        bool r340114 = r340112 <= r340113;
        double r340115 = x;
        double r340116 = t;
        double r340117 = r340115 / r340116;
        double r340118 = y;
        double r340119 = r340118 / r340116;
        double r340120 = r340117 - r340119;
        double r340121 = r340112 * r340120;
        double r340122 = r340115 - r340121;
        double r340123 = r340112 / r340116;
        double r340124 = r340115 - r340118;
        double r340125 = r340123 * r340124;
        double r340126 = r340115 - r340125;
        double r340127 = r340114 ? r340122 : r340126;
        return r340127;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.0
Target2.2
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.88671875:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;\left(y - x\right) \cdot \frac{z}{t} \lt -0.0:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -1.4743746062189412e-73

    1. Initial program 2.7

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Simplified2.7

      \[\leadsto \color{blue}{x - \frac{z}{t} \cdot \left(x - y\right)}\]
    3. Using strategy rm
    4. Applied div-inv2.8

      \[\leadsto x - \color{blue}{\left(z \cdot \frac{1}{t}\right)} \cdot \left(x - y\right)\]
    5. Applied associate-*l*2.2

      \[\leadsto x - \color{blue}{z \cdot \left(\frac{1}{t} \cdot \left(x - y\right)\right)}\]
    6. Simplified2.1

      \[\leadsto x - z \cdot \color{blue}{\frac{x - y}{t}}\]
    7. Using strategy rm
    8. Applied div-sub2.1

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

    if -1.4743746062189412e-73 < z

    1. Initial program 1.8

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Simplified1.8

      \[\leadsto \color{blue}{x - \frac{z}{t} \cdot \left(x - y\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.47437460621894122515597907358401131123 \cdot 10^{-73}:\\ \;\;\;\;x - z \cdot \left(\frac{x}{t} - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019179 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) -0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))

  (+ x (* (- y x) (/ z t))))