Average Error: 10.2 → 0.4
Time: 11.4s
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 r558231 = x;
        double r558232 = y;
        double r558233 = z;
        double r558234 = r558232 - r558233;
        double r558235 = t;
        double r558236 = r558234 * r558235;
        double r558237 = a;
        double r558238 = r558237 - r558233;
        double r558239 = r558236 / r558238;
        double r558240 = r558231 + r558239;
        return r558240;
}

double f(double x, double y, double z, double t, double a) {
        double r558241 = x;
        double r558242 = y;
        double r558243 = z;
        double r558244 = r558242 - r558243;
        double r558245 = t;
        double r558246 = r558244 * r558245;
        double r558247 = a;
        double r558248 = r558247 - r558243;
        double r558249 = r558246 / r558248;
        double r558250 = r558241 + r558249;
        double r558251 = -inf.0;
        bool r558252 = r558250 <= r558251;
        double r558253 = 6.2865338139530956e+268;
        bool r558254 = r558250 <= r558253;
        double r558255 = !r558254;
        bool r558256 = r558252 || r558255;
        double r558257 = r558245 / r558248;
        double r558258 = r558244 * r558257;
        double r558259 = r558241 + r558258;
        double r558260 = r558256 ? r558259 : r558250;
        return r558260;
}

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