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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r648427 = x;
        double r648428 = y;
        double r648429 = z;
        double r648430 = t;
        double r648431 = r648429 - r648430;
        double r648432 = r648428 * r648431;
        double r648433 = a;
        double r648434 = r648429 - r648433;
        double r648435 = r648432 / r648434;
        double r648436 = r648427 + r648435;
        return r648436;
}

double f(double x, double y, double z, double t, double a) {
        double r648437 = y;
        double r648438 = z;
        double r648439 = t;
        double r648440 = r648438 - r648439;
        double r648441 = r648437 * r648440;
        double r648442 = a;
        double r648443 = r648438 - r648442;
        double r648444 = r648441 / r648443;
        double r648445 = -inf.0;
        bool r648446 = r648444 <= r648445;
        double r648447 = x;
        double r648448 = r648443 / r648440;
        double r648449 = r648437 / r648448;
        double r648450 = r648447 + r648449;
        double r648451 = 4.169526603932679e+183;
        bool r648452 = r648444 <= r648451;
        double r648453 = r648447 + r648444;
        double r648454 = r648440 / r648443;
        double r648455 = r648437 * r648454;
        double r648456 = r648447 + r648455;
        double r648457 = r648452 ? r648453 : r648456;
        double r648458 = r648446 ? r648450 : r648457;
        return r648458;
}

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.6
Target1.2
Herbie0.5
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* y (- z t)) (- z a)) < -inf.0

    1. Initial program 64.0

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Using strategy rm
    3. Applied associate-/l*0.1

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}}\]

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

    1. Initial program 0.2

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

    if 4.169526603932679e+183 < (/ (* y (- z t)) (- z a))

    1. Initial program 44.5

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

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

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

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - t}{z - a}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.5

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

Reproduce

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

  :herbie-target
  (+ x (/ y (/ (- z a) (- z t))))

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