Average Error: 10.4 → 0.7
Time: 15.1s
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 + y \cdot \frac{z - t}{z - a}\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{z - a} \le 3.954881438153329540957030529518309511636 \cdot 10^{-164}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{z}{z - t} - \frac{a}{z - t}}\\ \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 + y \cdot \frac{z - t}{z - a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r403316 = x;
        double r403317 = y;
        double r403318 = z;
        double r403319 = t;
        double r403320 = r403318 - r403319;
        double r403321 = r403317 * r403320;
        double r403322 = a;
        double r403323 = r403318 - r403322;
        double r403324 = r403321 / r403323;
        double r403325 = r403316 + r403324;
        return r403325;
}

double f(double x, double y, double z, double t, double a) {
        double r403326 = y;
        double r403327 = z;
        double r403328 = t;
        double r403329 = r403327 - r403328;
        double r403330 = r403326 * r403329;
        double r403331 = a;
        double r403332 = r403327 - r403331;
        double r403333 = r403330 / r403332;
        double r403334 = -inf.0;
        bool r403335 = r403333 <= r403334;
        double r403336 = x;
        double r403337 = r403329 / r403332;
        double r403338 = r403326 * r403337;
        double r403339 = r403336 + r403338;
        double r403340 = 3.9548814381533295e-164;
        bool r403341 = r403333 <= r403340;
        double r403342 = r403336 + r403333;
        double r403343 = r403327 / r403329;
        double r403344 = r403331 / r403329;
        double r403345 = r403343 - r403344;
        double r403346 = r403326 / r403345;
        double r403347 = r403336 + r403346;
        double r403348 = r403341 ? r403342 : r403347;
        double r403349 = r403335 ? r403339 : r403348;
        return r403349;
}

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.4
Target1.4
Herbie0.7
\[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 *-un-lft-identity64.0

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

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

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

    if -inf.0 < (/ (* y (- z t)) (- z a)) < 3.9548814381533295e-164

    1. Initial program 0.3

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

    if 3.9548814381533295e-164 < (/ (* y (- z t)) (- z a))

    1. Initial program 14.8

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{z - a}{z - t}}}\]
    4. Using strategy rm
    5. Applied div-sub1.5

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

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

Reproduce

herbie shell --seed 2019325 
(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))))