Average Error: 11.4 → 1.2
Time: 14.9s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{t - z} = -\infty \lor \neg \left(\frac{x \cdot \left(y - z\right)}{t - z} \le -1.365734478966132226658538507803575688998 \cdot 10^{-303}\right):\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{t - z} = -\infty \lor \neg \left(\frac{x \cdot \left(y - z\right)}{t - z} \le -1.365734478966132226658538507803575688998 \cdot 10^{-303}\right):\\
\;\;\;\;x \cdot \frac{y - z}{t - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r370368 = x;
        double r370369 = y;
        double r370370 = z;
        double r370371 = r370369 - r370370;
        double r370372 = r370368 * r370371;
        double r370373 = t;
        double r370374 = r370373 - r370370;
        double r370375 = r370372 / r370374;
        return r370375;
}

double f(double x, double y, double z, double t) {
        double r370376 = x;
        double r370377 = y;
        double r370378 = z;
        double r370379 = r370377 - r370378;
        double r370380 = r370376 * r370379;
        double r370381 = t;
        double r370382 = r370381 - r370378;
        double r370383 = r370380 / r370382;
        double r370384 = -inf.0;
        bool r370385 = r370383 <= r370384;
        double r370386 = -1.3657344789661322e-303;
        bool r370387 = r370383 <= r370386;
        double r370388 = !r370387;
        bool r370389 = r370385 || r370388;
        double r370390 = r370379 / r370382;
        double r370391 = r370376 * r370390;
        double r370392 = r370389 ? r370391 : r370383;
        return r370392;
}

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
Herbie1.2
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (- y z)) (- t z)) < -inf.0 or -1.3657344789661322e-303 < (/ (* x (- y z)) (- t z))

    1. Initial program 17.7

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity17.7

      \[\leadsto \frac{x \cdot \left(y - z\right)}{\color{blue}{1 \cdot \left(t - z\right)}}\]
    4. Applied times-frac1.7

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y - z}{t - z}}\]
    5. Simplified1.7

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

    if -inf.0 < (/ (* x (- y z)) (- t z)) < -1.3657344789661322e-303

    1. Initial program 0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{t - z} = -\infty \lor \neg \left(\frac{x \cdot \left(y - z\right)}{t - z} \le -1.365734478966132226658538507803575688998 \cdot 10^{-303}\right):\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \end{array}\]

Reproduce

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