Average Error: 12.0 → 2.1
Time: 47.2s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.2829837846341168 \cdot 10^{+39}:\\ \;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\ \mathbf{elif}\;x \le -9.40081697359483 \cdot 10^{-169}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;x \le -1.2829837846341168 \cdot 10^{+39}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\

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

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y - z}{t - z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r27508218 = x;
        double r27508219 = y;
        double r27508220 = z;
        double r27508221 = r27508219 - r27508220;
        double r27508222 = r27508218 * r27508221;
        double r27508223 = t;
        double r27508224 = r27508223 - r27508220;
        double r27508225 = r27508222 / r27508224;
        return r27508225;
}

double f(double x, double y, double z, double t) {
        double r27508226 = x;
        double r27508227 = -1.2829837846341168e+39;
        bool r27508228 = r27508226 <= r27508227;
        double r27508229 = t;
        double r27508230 = z;
        double r27508231 = r27508229 - r27508230;
        double r27508232 = r27508226 / r27508231;
        double r27508233 = y;
        double r27508234 = r27508233 - r27508230;
        double r27508235 = r27508232 * r27508234;
        double r27508236 = -9.40081697359483e-169;
        bool r27508237 = r27508226 <= r27508236;
        double r27508238 = r27508226 * r27508234;
        double r27508239 = r27508238 / r27508231;
        double r27508240 = r27508234 / r27508231;
        double r27508241 = r27508226 * r27508240;
        double r27508242 = r27508237 ? r27508239 : r27508241;
        double r27508243 = r27508228 ? r27508235 : r27508242;
        return r27508243;
}

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

Original12.0
Target2.1
Herbie2.1
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -1.2829837846341168e+39

    1. Initial program 27.1

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

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

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

    if -1.2829837846341168e+39 < x < -9.40081697359483e-169

    1. Initial program 1.4

      \[\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}}}\]
    4. Using strategy rm
    5. Applied associate-/r/9.7

      \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \left(y - z\right)}\]
    6. Using strategy rm
    7. Applied associate-*l/1.4

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

    if -9.40081697359483e-169 < x

    1. Initial program 10.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.2829837846341168 \cdot 10^{+39}:\\ \;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\ \mathbf{elif}\;x \le -9.40081697359483 \cdot 10^{-169}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \end{array}\]

Reproduce

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

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

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