Average Error: 10.8 → 1.8
Time: 5.6s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.7620314914513706 \cdot 10^{-14} \lor \neg \left(y \le 3.8207927840147822 \cdot 10^{-149}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, z - 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.7620314914513706 \cdot 10^{-14} \lor \neg \left(y \le 3.8207927840147822 \cdot 10^{-149}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, z - 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 r667489 = x;
        double r667490 = y;
        double r667491 = z;
        double r667492 = t;
        double r667493 = r667491 - r667492;
        double r667494 = r667490 * r667493;
        double r667495 = a;
        double r667496 = r667495 - r667492;
        double r667497 = r667494 / r667496;
        double r667498 = r667489 + r667497;
        return r667498;
}

double f(double x, double y, double z, double t, double a) {
        double r667499 = y;
        double r667500 = -2.7620314914513706e-14;
        bool r667501 = r667499 <= r667500;
        double r667502 = 3.820792784014782e-149;
        bool r667503 = r667499 <= r667502;
        double r667504 = !r667503;
        bool r667505 = r667501 || r667504;
        double r667506 = a;
        double r667507 = t;
        double r667508 = r667506 - r667507;
        double r667509 = r667499 / r667508;
        double r667510 = z;
        double r667511 = r667510 - r667507;
        double r667512 = x;
        double r667513 = fma(r667509, r667511, r667512);
        double r667514 = r667511 * r667499;
        double r667515 = r667514 / r667508;
        double r667516 = r667515 + r667512;
        double r667517 = r667505 ? r667513 : r667516;
        return r667517;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -2.7620314914513706e-14 or 3.820792784014782e-149 < y

    1. Initial program 17.6

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

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

    if -2.7620314914513706e-14 < y < 3.820792784014782e-149

    1. Initial program 0.4

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

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

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

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

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

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

Reproduce

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

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

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