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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r23966188 = x;
        double r23966189 = y;
        double r23966190 = z;
        double r23966191 = r23966189 - r23966190;
        double r23966192 = t;
        double r23966193 = r23966191 * r23966192;
        double r23966194 = a;
        double r23966195 = r23966194 - r23966190;
        double r23966196 = r23966193 / r23966195;
        double r23966197 = r23966188 + r23966196;
        return r23966197;
}

double f(double x, double y, double z, double t, double a) {
        double r23966198 = y;
        double r23966199 = z;
        double r23966200 = r23966198 - r23966199;
        double r23966201 = t;
        double r23966202 = r23966200 * r23966201;
        double r23966203 = a;
        double r23966204 = r23966203 - r23966199;
        double r23966205 = r23966202 / r23966204;
        double r23966206 = -6.065378991960873e+280;
        bool r23966207 = r23966205 <= r23966206;
        double r23966208 = 1.0;
        double r23966209 = r23966204 / r23966198;
        double r23966210 = r23966208 / r23966209;
        double r23966211 = r23966199 / r23966204;
        double r23966212 = r23966210 - r23966211;
        double r23966213 = x;
        double r23966214 = fma(r23966201, r23966212, r23966213);
        double r23966215 = 8.542075138463656e+280;
        bool r23966216 = r23966205 <= r23966215;
        double r23966217 = r23966213 + r23966205;
        double r23966218 = r23966216 ? r23966217 : r23966214;
        double r23966219 = r23966207 ? r23966214 : r23966218;
        return r23966219;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original10.0
Target0.6
Herbie0.3
\[\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)) < -6.065378991960873e+280 or 8.542075138463656e+280 < (/ (* (- y z) t) (- a z))

    1. Initial program 56.8

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

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

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

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

    if -6.065378991960873e+280 < (/ (* (- y z) t) (- a z)) < 8.542075138463656e+280

    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.3

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

Reproduce

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