Average Error: 10.2 → 0.4
Time: 11.1s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(y - z\right) \cdot t}{a - z} = -\infty \lor \neg \left(x + \frac{\left(y - z\right) \cdot t}{a - z} \le 6.28653381395309557 \cdot 10^{268}\right):\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - z\right) \cdot t}{a - z} = -\infty \lor \neg \left(x + \frac{\left(y - z\right) \cdot t}{a - z} \le 6.28653381395309557 \cdot 10^{268}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r589337 = x;
        double r589338 = y;
        double r589339 = z;
        double r589340 = r589338 - r589339;
        double r589341 = t;
        double r589342 = r589340 * r589341;
        double r589343 = a;
        double r589344 = r589343 - r589339;
        double r589345 = r589342 / r589344;
        double r589346 = r589337 + r589345;
        return r589346;
}

double f(double x, double y, double z, double t, double a) {
        double r589347 = x;
        double r589348 = y;
        double r589349 = z;
        double r589350 = r589348 - r589349;
        double r589351 = t;
        double r589352 = r589350 * r589351;
        double r589353 = a;
        double r589354 = r589353 - r589349;
        double r589355 = r589352 / r589354;
        double r589356 = r589347 + r589355;
        double r589357 = -inf.0;
        bool r589358 = r589356 <= r589357;
        double r589359 = 6.2865338139530956e+268;
        bool r589360 = r589356 <= r589359;
        double r589361 = !r589360;
        bool r589362 = r589358 || r589361;
        double r589363 = r589351 / r589354;
        double r589364 = r589350 * r589363;
        double r589365 = r589347 + r589364;
        double r589366 = r589362 ? r589365 : r589356;
        return r589366;
}

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.2
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 (+ x (/ (* (- y z) t) (- a z))) < -inf.0 or 6.2865338139530956e+268 < (+ x (/ (* (- y z) t) (- a z)))

    1. Initial program 52.1

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

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

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

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

    if -inf.0 < (+ x (/ (* (- y z) t) (- a z))) < 6.2865338139530956e+268

    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}\;x + \frac{\left(y - z\right) \cdot t}{a - z} = -\infty \lor \neg \left(x + \frac{\left(y - z\right) \cdot t}{a - z} \le 6.28653381395309557 \cdot 10^{268}\right):\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \end{array}\]

Reproduce

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

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