Average Error: 10.5 → 0.8
Time: 21.9s
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:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \le 2.230539562063803674617122870394244738967 \cdot 10^{119}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \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:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r21934396 = x;
        double r21934397 = y;
        double r21934398 = z;
        double r21934399 = r21934397 - r21934398;
        double r21934400 = t;
        double r21934401 = r21934399 * r21934400;
        double r21934402 = a;
        double r21934403 = r21934402 - r21934398;
        double r21934404 = r21934401 / r21934403;
        double r21934405 = r21934396 + r21934404;
        return r21934405;
}

double f(double x, double y, double z, double t, double a) {
        double r21934406 = y;
        double r21934407 = z;
        double r21934408 = r21934406 - r21934407;
        double r21934409 = t;
        double r21934410 = r21934408 * r21934409;
        double r21934411 = a;
        double r21934412 = r21934411 - r21934407;
        double r21934413 = r21934410 / r21934412;
        double r21934414 = -inf.0;
        bool r21934415 = r21934413 <= r21934414;
        double r21934416 = x;
        double r21934417 = r21934409 / r21934412;
        double r21934418 = r21934408 * r21934417;
        double r21934419 = r21934416 + r21934418;
        double r21934420 = 2.2305395620638037e+119;
        bool r21934421 = r21934413 <= r21934420;
        double r21934422 = r21934413 + r21934416;
        double r21934423 = r21934421 ? r21934422 : r21934419;
        double r21934424 = r21934415 ? r21934419 : r21934423;
        return r21934424;
}

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.5
Target0.6
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;t \lt -1.068297449017406694366747246993994850729 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.911094988758637497591020599238553861375 \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 2.2305395620638037e+119 < (/ (* (- y z) t) (- a z))

    1. Initial program 46.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, \frac{y - z}{a - z}, x\right)}\]
    3. Using strategy rm
    4. Applied clear-num1.8

      \[\leadsto \mathsf{fma}\left(t, \color{blue}{\frac{1}{\frac{a - z}{y - z}}}, x\right)\]
    5. Using strategy rm
    6. Applied fma-udef1.8

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

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

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

    1. Initial program 0.3

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

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

Reproduce

herbie shell --seed 2019169 +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))))