Average Error: 1.3 → 0.6
Time: 5.0s
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -7.90788715625825451 \cdot 10^{-48} \lor \neg \left(y \le 2.5371231932369919 \cdot 10^{-149}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{z - a}\\ \end{array}\]
x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -7.90788715625825451 \cdot 10^{-48} \lor \neg \left(y \le 2.5371231932369919 \cdot 10^{-149}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r688612 = x;
        double r688613 = y;
        double r688614 = z;
        double r688615 = t;
        double r688616 = r688614 - r688615;
        double r688617 = a;
        double r688618 = r688614 - r688617;
        double r688619 = r688616 / r688618;
        double r688620 = r688613 * r688619;
        double r688621 = r688612 + r688620;
        return r688621;
}

double f(double x, double y, double z, double t, double a) {
        double r688622 = y;
        double r688623 = -7.907887156258255e-48;
        bool r688624 = r688622 <= r688623;
        double r688625 = 2.537123193236992e-149;
        bool r688626 = r688622 <= r688625;
        double r688627 = !r688626;
        bool r688628 = r688624 || r688627;
        double r688629 = x;
        double r688630 = z;
        double r688631 = t;
        double r688632 = r688630 - r688631;
        double r688633 = a;
        double r688634 = r688630 - r688633;
        double r688635 = r688632 / r688634;
        double r688636 = r688622 * r688635;
        double r688637 = r688629 + r688636;
        double r688638 = r688622 * r688632;
        double r688639 = 1.0;
        double r688640 = r688639 / r688634;
        double r688641 = r688638 * r688640;
        double r688642 = r688629 + r688641;
        double r688643 = r688628 ? r688637 : r688642;
        return r688643;
}

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

Original1.3
Target1.2
Herbie0.6
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -7.907887156258255e-48 or 2.537123193236992e-149 < y

    1. Initial program 0.6

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

    if -7.907887156258255e-48 < y < 2.537123193236992e-149

    1. Initial program 2.6

      \[x + y \cdot \frac{z - t}{z - a}\]
    2. Using strategy rm
    3. Applied div-inv2.6

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

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

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

Reproduce

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

  :herbie-target
  (+ x (/ y (/ (- z a) (- z t))))

  (+ x (* y (/ (- z t) (- z a)))))