Average Error: 11.0 → 0.3
Time: 27.1s
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:\\ \;\;\;\;\frac{t}{\frac{a - z}{y - z}} + x\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \le 5.552371922583118058479301672117614849246 \cdot 10^{278}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y - z}{a - z}, t, 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:\\
\;\;\;\;\frac{t}{\frac{a - z}{y - z}} + x\\

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

\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 r33039041 = x;
        double r33039042 = y;
        double r33039043 = z;
        double r33039044 = r33039042 - r33039043;
        double r33039045 = t;
        double r33039046 = r33039044 * r33039045;
        double r33039047 = a;
        double r33039048 = r33039047 - r33039043;
        double r33039049 = r33039046 / r33039048;
        double r33039050 = r33039041 + r33039049;
        return r33039050;
}

double f(double x, double y, double z, double t, double a) {
        double r33039051 = y;
        double r33039052 = z;
        double r33039053 = r33039051 - r33039052;
        double r33039054 = t;
        double r33039055 = r33039053 * r33039054;
        double r33039056 = a;
        double r33039057 = r33039056 - r33039052;
        double r33039058 = r33039055 / r33039057;
        double r33039059 = -inf.0;
        bool r33039060 = r33039058 <= r33039059;
        double r33039061 = r33039057 / r33039053;
        double r33039062 = r33039054 / r33039061;
        double r33039063 = x;
        double r33039064 = r33039062 + r33039063;
        double r33039065 = 5.552371922583118e+278;
        bool r33039066 = r33039058 <= r33039065;
        double r33039067 = r33039063 + r33039058;
        double r33039068 = r33039053 / r33039057;
        double r33039069 = fma(r33039068, r33039054, r33039063);
        double r33039070 = r33039066 ? r33039067 : r33039069;
        double r33039071 = r33039060 ? r33039064 : r33039070;
        return r33039071;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original11.0
Target0.6
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;t \lt -1.068297449017406694366747246993994850729 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.911094988758637497591020599238553861375 \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 3 regimes
  2. if (/ (* (- y z) t) (- a z)) < -inf.0

    1. Initial program 64.0

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

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

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

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

      \[\leadsto \color{blue}{\frac{t}{\frac{a - z}{y - z}}} + x\]

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

    1. Initial program 0.2

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

    if 5.552371922583118e+278 < (/ (* (- y z) t) (- a z))

    1. Initial program 59.8

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

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

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

Reproduce

herbie shell --seed 2019174 +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))))