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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r9866963 = x;
        double r9866964 = y;
        double r9866965 = z;
        double r9866966 = r9866964 - r9866965;
        double r9866967 = t;
        double r9866968 = r9866966 * r9866967;
        double r9866969 = a;
        double r9866970 = r9866969 - r9866965;
        double r9866971 = r9866968 / r9866970;
        double r9866972 = r9866963 + r9866971;
        return r9866972;
}

double f(double x, double y, double z, double t, double a) {
        double r9866973 = y;
        double r9866974 = z;
        double r9866975 = r9866973 - r9866974;
        double r9866976 = t;
        double r9866977 = r9866975 * r9866976;
        double r9866978 = a;
        double r9866979 = r9866978 - r9866974;
        double r9866980 = r9866977 / r9866979;
        double r9866981 = -inf.0;
        bool r9866982 = r9866980 <= r9866981;
        double r9866983 = r9866976 / r9866979;
        double r9866984 = x;
        double r9866985 = fma(r9866975, r9866983, r9866984);
        double r9866986 = 5.257691405153691e+306;
        bool r9866987 = r9866980 <= r9866986;
        double r9866988 = r9866984 + r9866980;
        double r9866989 = r9866987 ? r9866988 : r9866985;
        double r9866990 = r9866982 ? r9866985 : r9866989;
        return r9866990;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original9.8
Target0.4
Herbie0.2
\[\begin{array}{l} \mathbf{if}\;t \lt -1.0682974490174067 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.9110949887586375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array}\]

Derivation

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

    1. Initial program 60.1

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

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

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

    1. Initial program 0.2

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

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

Reproduce

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

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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