Average Error: 10.1 → 0.4
Time: 16.6s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} = -\infty:\\ \;\;\;\;\frac{t}{a - z} \cdot \left(y - z\right) + x\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \le 1.8696604680231408 \cdot 10^{+251}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{a - z} \cdot \left(y - z\right) + x\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
\mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} = -\infty:\\
\;\;\;\;\frac{t}{a - z} \cdot \left(y - z\right) + x\\

\mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \le 1.8696604680231408 \cdot 10^{+251}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r30830379 = x;
        double r30830380 = y;
        double r30830381 = z;
        double r30830382 = r30830380 - r30830381;
        double r30830383 = t;
        double r30830384 = r30830382 * r30830383;
        double r30830385 = a;
        double r30830386 = r30830385 - r30830381;
        double r30830387 = r30830384 / r30830386;
        double r30830388 = r30830379 + r30830387;
        return r30830388;
}

double f(double x, double y, double z, double t, double a) {
        double r30830389 = y;
        double r30830390 = z;
        double r30830391 = r30830389 - r30830390;
        double r30830392 = t;
        double r30830393 = r30830391 * r30830392;
        double r30830394 = a;
        double r30830395 = r30830394 - r30830390;
        double r30830396 = r30830393 / r30830395;
        double r30830397 = -inf.0;
        bool r30830398 = r30830396 <= r30830397;
        double r30830399 = r30830392 / r30830395;
        double r30830400 = r30830399 * r30830391;
        double r30830401 = x;
        double r30830402 = r30830400 + r30830401;
        double r30830403 = 1.8696604680231408e+251;
        bool r30830404 = r30830396 <= r30830403;
        double r30830405 = r30830396 + r30830401;
        double r30830406 = r30830404 ? r30830405 : r30830402;
        double r30830407 = r30830398 ? r30830402 : r30830406;
        return r30830407;
}

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

Original10.1
Target0.6
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;t \lt -1.0682974490174067 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.9110949887586375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* (- y z) t) (- a z)) < -inf.0 or 1.8696604680231408e+251 < (/ (* (- y z) t) (- a z))

    1. Initial program 55.7

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

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

      \[\leadsto x + \color{blue}{\frac{y - z}{1} \cdot \frac{t}{a - z}}\]
    5. Simplified1.3

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

    if -inf.0 < (/ (* (- y z) t) (- a z)) < 1.8696604680231408e+251

    1. Initial program 0.2

      \[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} = -\infty:\\ \;\;\;\;\frac{t}{a - z} \cdot \left(y - z\right) + x\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \le 1.8696604680231408 \cdot 10^{+251}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{a - z} \cdot \left(y - z\right) + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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