Average Error: 10.8 → 0.9
Time: 21.4s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le 2.169572803740489631006595870561008715562 \cdot 10^{-263} \lor \neg \left(y \le 1.521401800345782231206513354388604186695 \cdot 10^{-8}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le 2.169572803740489631006595870561008715562 \cdot 10^{-263} \lor \neg \left(y \le 1.521401800345782231206513354388604186695 \cdot 10^{-8}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r359372 = x;
        double r359373 = y;
        double r359374 = z;
        double r359375 = t;
        double r359376 = r359374 - r359375;
        double r359377 = r359373 * r359376;
        double r359378 = a;
        double r359379 = r359378 - r359375;
        double r359380 = r359377 / r359379;
        double r359381 = r359372 + r359380;
        return r359381;
}

double f(double x, double y, double z, double t, double a) {
        double r359382 = y;
        double r359383 = 2.1695728037404896e-263;
        bool r359384 = r359382 <= r359383;
        double r359385 = 1.5214018003457822e-08;
        bool r359386 = r359382 <= r359385;
        double r359387 = !r359386;
        bool r359388 = r359384 || r359387;
        double r359389 = z;
        double r359390 = t;
        double r359391 = r359389 - r359390;
        double r359392 = a;
        double r359393 = r359392 - r359390;
        double r359394 = r359391 / r359393;
        double r359395 = x;
        double r359396 = fma(r359382, r359394, r359395);
        double r359397 = r359391 * r359382;
        double r359398 = r359397 / r359393;
        double r359399 = r359398 + r359395;
        double r359400 = r359388 ? r359396 : r359399;
        return r359400;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < 2.1695728037404896e-263 or 1.5214018003457822e-08 < y

    1. Initial program 13.7

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

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

    if 2.1695728037404896e-263 < y < 1.5214018003457822e-08

    1. Initial program 0.3

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

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

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

      \[\leadsto \color{blue}{\frac{y}{a - t} \cdot \left(z - t\right)} + x\]
    6. Using strategy rm
    7. Applied associate-*l/0.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 2.169572803740489631006595870561008715562 \cdot 10^{-263} \lor \neg \left(y \le 1.521401800345782231206513354388604186695 \cdot 10^{-8}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \end{array}\]

Reproduce

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

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

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