Average Error: 10.7 → 1.6
Time: 4.7s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -5.04139806549743016 \cdot 10^{-72} \lor \neg \left(y \le 2.08255120604207899 \cdot 10^{-80}\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 -5.04139806549743016 \cdot 10^{-72} \lor \neg \left(y \le 2.08255120604207899 \cdot 10^{-80}\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 r558932 = x;
        double r558933 = y;
        double r558934 = z;
        double r558935 = t;
        double r558936 = r558934 - r558935;
        double r558937 = r558933 * r558936;
        double r558938 = a;
        double r558939 = r558938 - r558935;
        double r558940 = r558937 / r558939;
        double r558941 = r558932 + r558940;
        return r558941;
}

double f(double x, double y, double z, double t, double a) {
        double r558942 = y;
        double r558943 = -5.04139806549743e-72;
        bool r558944 = r558942 <= r558943;
        double r558945 = 2.082551206042079e-80;
        bool r558946 = r558942 <= r558945;
        double r558947 = !r558946;
        bool r558948 = r558944 || r558947;
        double r558949 = a;
        double r558950 = t;
        double r558951 = r558949 - r558950;
        double r558952 = r558942 / r558951;
        double r558953 = z;
        double r558954 = r558953 - r558950;
        double r558955 = x;
        double r558956 = fma(r558952, r558954, r558955);
        double r558957 = r558954 * r558942;
        double r558958 = r558957 / r558951;
        double r558959 = r558958 + r558955;
        double r558960 = r558948 ? r558956 : r558959;
        return r558960;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original10.7
Target1.2
Herbie1.6
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -5.04139806549743e-72 or 2.082551206042079e-80 < y

    1. Initial program 17.9

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

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

    if -5.04139806549743e-72 < y < 2.082551206042079e-80

    1. Initial program 0.4

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

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

      \[\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-udef4.3

      \[\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.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -5.04139806549743016 \cdot 10^{-72} \lor \neg \left(y \le 2.08255120604207899 \cdot 10^{-80}\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 2020089 +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))))