Average Error: 10.4 → 0.3
Time: 15.8s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.637379201468953986949485320636358182223 \cdot 10^{-36} \lor \neg \left(y \le 3.205739178188263417782161531329637455788 \cdot 10^{-56}\right):\\ \;\;\;\;y \cdot \frac{z - t}{a - t} + x\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le -4.637379201468953986949485320636358182223 \cdot 10^{-36} \lor \neg \left(y \le 3.205739178188263417782161531329637455788 \cdot 10^{-56}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a - t} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r316274 = x;
        double r316275 = y;
        double r316276 = z;
        double r316277 = t;
        double r316278 = r316276 - r316277;
        double r316279 = r316275 * r316278;
        double r316280 = a;
        double r316281 = r316280 - r316277;
        double r316282 = r316279 / r316281;
        double r316283 = r316274 + r316282;
        return r316283;
}

double f(double x, double y, double z, double t, double a) {
        double r316284 = y;
        double r316285 = -4.637379201468954e-36;
        bool r316286 = r316284 <= r316285;
        double r316287 = 3.2057391781882634e-56;
        bool r316288 = r316284 <= r316287;
        double r316289 = !r316288;
        bool r316290 = r316286 || r316289;
        double r316291 = z;
        double r316292 = t;
        double r316293 = r316291 - r316292;
        double r316294 = a;
        double r316295 = r316294 - r316292;
        double r316296 = r316293 / r316295;
        double r316297 = r316284 * r316296;
        double r316298 = x;
        double r316299 = r316297 + r316298;
        double r316300 = r316284 * r316293;
        double r316301 = 1.0;
        double r316302 = r316301 / r316295;
        double r316303 = r316300 * r316302;
        double r316304 = r316303 + r316298;
        double r316305 = r316290 ? r316299 : r316304;
        return r316305;
}

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.4
Target1.2
Herbie0.3
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -4.637379201468954e-36 or 3.2057391781882634e-56 < y

    1. Initial program 18.9

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

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

      \[\leadsto \color{blue}{\frac{y}{a - t} \cdot \left(z - t\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv2.2

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a - t}\right)} \cdot \left(z - t\right) + x\]
    7. Applied associate-*l*0.5

      \[\leadsto \color{blue}{y \cdot \left(\frac{1}{a - t} \cdot \left(z - t\right)\right)} + x\]
    8. Simplified0.4

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

    if -4.637379201468954e-36 < y < 3.2057391781882634e-56

    1. Initial program 0.2

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

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

      \[\leadsto \color{blue}{\frac{y}{a - t} \cdot \left(z - t\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv3.7

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a - t}\right)} \cdot \left(z - t\right) + x\]
    7. Applied associate-*l*2.3

      \[\leadsto \color{blue}{y \cdot \left(\frac{1}{a - t} \cdot \left(z - t\right)\right)} + x\]
    8. Simplified2.3

      \[\leadsto y \cdot \color{blue}{\frac{z - t}{a - t}} + x\]
    9. Using strategy rm
    10. Applied div-inv2.3

      \[\leadsto y \cdot \color{blue}{\left(\left(z - t\right) \cdot \frac{1}{a - t}\right)} + x\]
    11. Applied associate-*r*0.3

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

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

Reproduce

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