Average Error: 10.4 → 0.3
Time: 16.0s
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 r316607 = x;
        double r316608 = y;
        double r316609 = z;
        double r316610 = t;
        double r316611 = r316609 - r316610;
        double r316612 = r316608 * r316611;
        double r316613 = a;
        double r316614 = r316613 - r316610;
        double r316615 = r316612 / r316614;
        double r316616 = r316607 + r316615;
        return r316616;
}

double f(double x, double y, double z, double t, double a) {
        double r316617 = y;
        double r316618 = -4.637379201468954e-36;
        bool r316619 = r316617 <= r316618;
        double r316620 = 3.2057391781882634e-56;
        bool r316621 = r316617 <= r316620;
        double r316622 = !r316621;
        bool r316623 = r316619 || r316622;
        double r316624 = z;
        double r316625 = t;
        double r316626 = r316624 - r316625;
        double r316627 = a;
        double r316628 = r316627 - r316625;
        double r316629 = r316626 / r316628;
        double r316630 = r316617 * r316629;
        double r316631 = x;
        double r316632 = r316630 + r316631;
        double r316633 = r316617 * r316626;
        double r316634 = 1.0;
        double r316635 = r316634 / r316628;
        double r316636 = r316633 * r316635;
        double r316637 = r316636 + r316631;
        double r316638 = r316623 ? r316632 : r316637;
        return r316638;
}

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