Average Error: 10.4 → 0.7
Time: 14.5s
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 r374281 = x;
        double r374282 = y;
        double r374283 = z;
        double r374284 = t;
        double r374285 = r374283 - r374284;
        double r374286 = r374282 * r374285;
        double r374287 = a;
        double r374288 = r374283 - r374287;
        double r374289 = r374286 / r374288;
        double r374290 = r374281 + r374289;
        return r374290;
}

double f(double x, double y, double z, double t, double a) {
        double r374291 = y;
        double r374292 = z;
        double r374293 = t;
        double r374294 = r374292 - r374293;
        double r374295 = r374291 * r374294;
        double r374296 = a;
        double r374297 = r374292 - r374296;
        double r374298 = r374295 / r374297;
        double r374299 = -inf.0;
        bool r374300 = r374298 <= r374299;
        double r374301 = x;
        double r374302 = r374294 / r374297;
        double r374303 = r374291 * r374302;
        double r374304 = r374301 + r374303;
        double r374305 = 3.9548814381533295e-164;
        bool r374306 = r374298 <= r374305;
        double r374307 = r374301 + r374298;
        double r374308 = r374292 / r374294;
        double r374309 = r374296 / r374294;
        double r374310 = r374308 - r374309;
        double r374311 = r374291 / r374310;
        double r374312 = r374301 + r374311;
        double r374313 = r374306 ? r374307 : r374312;
        double r374314 = r374300 ? r374304 : r374313;
        return r374314;
}

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