Average Error: 10.6 → 0.4
Time: 3.5s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;t \le -5.214740867201422251548963035487610456322 \cdot 10^{-31} \lor \neg \left(t \le 1558841615728887808\right):\\ \;\;\;\;\frac{y - z}{a - z} \cdot t + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
\mathbf{if}\;t \le -5.214740867201422251548963035487610456322 \cdot 10^{-31} \lor \neg \left(t \le 1558841615728887808\right):\\
\;\;\;\;\frac{y - z}{a - z} \cdot t + x\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r544987 = x;
        double r544988 = y;
        double r544989 = z;
        double r544990 = r544988 - r544989;
        double r544991 = t;
        double r544992 = r544990 * r544991;
        double r544993 = a;
        double r544994 = r544993 - r544989;
        double r544995 = r544992 / r544994;
        double r544996 = r544987 + r544995;
        return r544996;
}

double f(double x, double y, double z, double t, double a) {
        double r544997 = t;
        double r544998 = -5.214740867201422e-31;
        bool r544999 = r544997 <= r544998;
        double r545000 = 1.5588416157288878e+18;
        bool r545001 = r544997 <= r545000;
        double r545002 = !r545001;
        bool r545003 = r544999 || r545002;
        double r545004 = y;
        double r545005 = z;
        double r545006 = r545004 - r545005;
        double r545007 = a;
        double r545008 = r545007 - r545005;
        double r545009 = r545006 / r545008;
        double r545010 = r545009 * r544997;
        double r545011 = x;
        double r545012 = r545010 + r545011;
        double r545013 = r545006 * r544997;
        double r545014 = r545013 / r545008;
        double r545015 = r545014 + r545011;
        double r545016 = r545003 ? r545012 : r545015;
        return r545016;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.6
Target0.5
Herbie0.4
\[\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 2 regimes
  2. if t < -5.214740867201422e-31 or 1.5588416157288878e+18 < t

    1. Initial program 22.0

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

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

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

    if -5.214740867201422e-31 < t < 1.5588416157288878e+18

    1. Initial program 0.3

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

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

      \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot t + x}\]
    5. Using strategy rm
    6. Applied associate-*l/0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -5.214740867201422251548963035487610456322 \cdot 10^{-31} \lor \neg \left(t \le 1558841615728887808\right):\\ \;\;\;\;\frac{y - z}{a - z} \cdot t + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \end{array}\]

Reproduce

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

  :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))))