Average Error: 11.4 → 2.2
Time: 4.5s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.774941709796473919963699961412214284686 \cdot 10^{-102} \lor \neg \left(z \le 2.757065980146846613575356502699254346611 \cdot 10^{-265}\right):\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;z \le -5.774941709796473919963699961412214284686 \cdot 10^{-102} \lor \neg \left(z \le 2.757065980146846613575356502699254346611 \cdot 10^{-265}\right):\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r921677 = x;
        double r921678 = y;
        double r921679 = z;
        double r921680 = r921678 - r921679;
        double r921681 = r921677 * r921680;
        double r921682 = t;
        double r921683 = r921682 - r921679;
        double r921684 = r921681 / r921683;
        return r921684;
}

double f(double x, double y, double z, double t) {
        double r921685 = z;
        double r921686 = -5.774941709796474e-102;
        bool r921687 = r921685 <= r921686;
        double r921688 = 2.7570659801468466e-265;
        bool r921689 = r921685 <= r921688;
        double r921690 = !r921689;
        bool r921691 = r921687 || r921690;
        double r921692 = x;
        double r921693 = t;
        double r921694 = r921693 - r921685;
        double r921695 = y;
        double r921696 = r921695 - r921685;
        double r921697 = r921694 / r921696;
        double r921698 = r921692 / r921697;
        double r921699 = r921692 / r921694;
        double r921700 = r921699 * r921696;
        double r921701 = r921691 ? r921698 : r921700;
        return r921701;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.4
Target2.1
Herbie2.2
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -5.774941709796474e-102 or 2.7570659801468466e-265 < z

    1. Initial program 12.6

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied associate-/l*1.3

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

    if -5.774941709796474e-102 < z < 2.7570659801468466e-265

    1. Initial program 5.9

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied associate-/l*5.8

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}}\]
    4. Using strategy rm
    5. Applied associate-/r/6.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.774941709796473919963699961412214284686 \cdot 10^{-102} \lor \neg \left(z \le 2.757065980146846613575356502699254346611 \cdot 10^{-265}\right):\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019362 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
  :precision binary64

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

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