Average Error: 11.3 → 2.1
Time: 3.0s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.20131362571466874 \cdot 10^{-152}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{elif}\;z \le 1.3063150334973689 \cdot 10^{-252}:\\ \;\;\;\;\frac{x \cdot y + x \cdot \left(-z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(y - z\right) \cdot \frac{1}{t - z}\right)\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;z \le -1.20131362571466874 \cdot 10^{-152}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\

\mathbf{elif}\;z \le 1.3063150334973689 \cdot 10^{-252}:\\
\;\;\;\;\frac{x \cdot y + x \cdot \left(-z\right)}{t - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r558241 = x;
        double r558242 = y;
        double r558243 = z;
        double r558244 = r558242 - r558243;
        double r558245 = r558241 * r558244;
        double r558246 = t;
        double r558247 = r558246 - r558243;
        double r558248 = r558245 / r558247;
        return r558248;
}

double f(double x, double y, double z, double t) {
        double r558249 = z;
        double r558250 = -1.2013136257146687e-152;
        bool r558251 = r558249 <= r558250;
        double r558252 = x;
        double r558253 = t;
        double r558254 = r558253 - r558249;
        double r558255 = y;
        double r558256 = r558255 - r558249;
        double r558257 = r558254 / r558256;
        double r558258 = r558252 / r558257;
        double r558259 = 1.3063150334973689e-252;
        bool r558260 = r558249 <= r558259;
        double r558261 = r558252 * r558255;
        double r558262 = -r558249;
        double r558263 = r558252 * r558262;
        double r558264 = r558261 + r558263;
        double r558265 = r558264 / r558254;
        double r558266 = 1.0;
        double r558267 = r558266 / r558254;
        double r558268 = r558256 * r558267;
        double r558269 = r558252 * r558268;
        double r558270 = r558260 ? r558265 : r558269;
        double r558271 = r558251 ? r558258 : r558270;
        return r558271;
}

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

Derivation

  1. Split input into 3 regimes
  2. if z < -1.2013136257146687e-152

    1. Initial program 13.7

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

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

    if -1.2013136257146687e-152 < z < 1.3063150334973689e-252

    1. Initial program 5.8

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied sub-neg5.8

      \[\leadsto \frac{x \cdot \color{blue}{\left(y + \left(-z\right)\right)}}{t - z}\]
    4. Applied distribute-lft-in5.8

      \[\leadsto \frac{\color{blue}{x \cdot y + x \cdot \left(-z\right)}}{t - z}\]

    if 1.3063150334973689e-252 < z

    1. Initial program 11.2

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y - z}{t - z}\]
    6. Using strategy rm
    7. Applied div-inv1.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.20131362571466874 \cdot 10^{-152}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{elif}\;z \le 1.3063150334973689 \cdot 10^{-252}:\\ \;\;\;\;\frac{x \cdot y + x \cdot \left(-z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(y - z\right) \cdot \frac{1}{t - z}\right)\\ \end{array}\]

Reproduce

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