Average Error: 11.0 → 1.4
Time: 3.8s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.77395754520233479 \cdot 10^{-156} \lor \neg \left(t \le 3.35743028334156564 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{z - t}{a - t} \cdot y + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -1.77395754520233479 \cdot 10^{-156} \lor \neg \left(t \le 3.35743028334156564 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{z - t}{a - t} \cdot y + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r568671 = x;
        double r568672 = y;
        double r568673 = z;
        double r568674 = t;
        double r568675 = r568673 - r568674;
        double r568676 = r568672 * r568675;
        double r568677 = a;
        double r568678 = r568677 - r568674;
        double r568679 = r568676 / r568678;
        double r568680 = r568671 + r568679;
        return r568680;
}

double f(double x, double y, double z, double t, double a) {
        double r568681 = t;
        double r568682 = -1.7739575452023348e-156;
        bool r568683 = r568681 <= r568682;
        double r568684 = 3.3574302833415656e-19;
        bool r568685 = r568681 <= r568684;
        double r568686 = !r568685;
        bool r568687 = r568683 || r568686;
        double r568688 = z;
        double r568689 = r568688 - r568681;
        double r568690 = a;
        double r568691 = r568690 - r568681;
        double r568692 = r568689 / r568691;
        double r568693 = y;
        double r568694 = r568692 * r568693;
        double r568695 = x;
        double r568696 = r568694 + r568695;
        double r568697 = r568689 * r568693;
        double r568698 = r568697 / r568691;
        double r568699 = r568698 + r568695;
        double r568700 = r568687 ? r568696 : r568699;
        return r568700;
}

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

Original11.0
Target1.3
Herbie1.4
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -1.7739575452023348e-156 or 3.3574302833415656e-19 < t

    1. Initial program 14.7

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a - t}{y}} \cdot \left(z - t\right) + x}\]
    7. Simplified3.0

      \[\leadsto \color{blue}{\frac{z - t}{\frac{a - t}{y}}} + x\]
    8. Using strategy rm
    9. Applied associate-/r/0.4

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

    if -1.7739575452023348e-156 < t < 3.3574302833415656e-19

    1. Initial program 3.5

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

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

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

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

      \[\leadsto \color{blue}{\frac{z - t}{\frac{a - t}{y}}} + x\]
    8. Using strategy rm
    9. Applied associate-/r/3.5

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

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

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

Reproduce

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