Average Error: 10.6 → 0.5
Time: 10.2s
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 r613758 = x;
        double r613759 = y;
        double r613760 = z;
        double r613761 = t;
        double r613762 = r613760 - r613761;
        double r613763 = r613759 * r613762;
        double r613764 = a;
        double r613765 = r613760 - r613764;
        double r613766 = r613763 / r613765;
        double r613767 = r613758 + r613766;
        return r613767;
}

double f(double x, double y, double z, double t, double a) {
        double r613768 = y;
        double r613769 = z;
        double r613770 = t;
        double r613771 = r613769 - r613770;
        double r613772 = r613768 * r613771;
        double r613773 = a;
        double r613774 = r613769 - r613773;
        double r613775 = r613772 / r613774;
        double r613776 = -inf.0;
        bool r613777 = r613775 <= r613776;
        double r613778 = x;
        double r613779 = r613774 / r613771;
        double r613780 = r613768 / r613779;
        double r613781 = r613778 + r613780;
        double r613782 = 4.169526603932679e+183;
        bool r613783 = r613775 <= r613782;
        double r613784 = r613778 + r613775;
        double r613785 = r613771 / r613774;
        double r613786 = r613768 * r613785;
        double r613787 = r613778 + r613786;
        double r613788 = r613783 ? r613784 : r613787;
        double r613789 = r613777 ? r613781 : r613788;
        return r613789;
}

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