Average Error: 10.8 → 0.3
Time: 55.1s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(z - t\right) \cdot y}{z - a} = -\infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\ \mathbf{elif}\;\frac{\left(z - t\right) \cdot y}{z - a} \le 1.371567967832367959726970635164993165166 \cdot 10^{294}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{z - a} + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;\frac{\left(z - t\right) \cdot y}{z - a} = -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r26791560 = x;
        double r26791561 = y;
        double r26791562 = z;
        double r26791563 = t;
        double r26791564 = r26791562 - r26791563;
        double r26791565 = r26791561 * r26791564;
        double r26791566 = a;
        double r26791567 = r26791562 - r26791566;
        double r26791568 = r26791565 / r26791567;
        double r26791569 = r26791560 + r26791568;
        return r26791569;
}

double f(double x, double y, double z, double t, double a) {
        double r26791570 = z;
        double r26791571 = t;
        double r26791572 = r26791570 - r26791571;
        double r26791573 = y;
        double r26791574 = r26791572 * r26791573;
        double r26791575 = a;
        double r26791576 = r26791570 - r26791575;
        double r26791577 = r26791574 / r26791576;
        double r26791578 = -inf.0;
        bool r26791579 = r26791577 <= r26791578;
        double r26791580 = r26791573 / r26791576;
        double r26791581 = x;
        double r26791582 = fma(r26791580, r26791572, r26791581);
        double r26791583 = 1.371567967832368e+294;
        bool r26791584 = r26791577 <= r26791583;
        double r26791585 = r26791577 + r26791581;
        double r26791586 = r26791584 ? r26791585 : r26791582;
        double r26791587 = r26791579 ? r26791582 : r26791586;
        return r26791587;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original10.8
Target1.3
Herbie0.3
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* y (- z t)) (- z a)) < -inf.0 or 1.371567967832368e+294 < (/ (* y (- z t)) (- z a))

    1. Initial program 62.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)}\]

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

    1. Initial program 0.3

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

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

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

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

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

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

Reproduce

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

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

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