Average Error: 11.1 → 2.2
Time: 4.3s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -2.4822864824141573 \cdot 10^{-288} \lor \neg \left(z \leq 1.081099186151696 \cdot 10^{-51}\right):\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot x}{t - z}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;z \leq -2.4822864824141573 \cdot 10^{-288} \lor \neg \left(z \leq 1.081099186151696 \cdot 10^{-51}\right):\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -2.4822864824141573e-288) (not (<= z 1.081099186151696e-51)))
   (/ x (/ (- t z) (- y z)))
   (/ (- (* x y) (* z x)) (- t z))))
double code(double x, double y, double z, double t) {
	return (x * (y - z)) / (t - z);
}
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -2.4822864824141573e-288) || !(z <= 1.081099186151696e-51)) {
		tmp = x / ((t - z) / (y - z));
	} else {
		tmp = ((x * y) - (z * x)) / (t - z);
	}
	return tmp;
}

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

Derivation

  1. Split input into 2 regimes
  2. if z < -2.48228648241415734e-288 or 1.08109918615169594e-51 < z

    1. Initial program 12.7

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

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

    if -2.48228648241415734e-288 < z < 1.08109918615169594e-51

    1. Initial program 5.4

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.4822864824141573 \cdot 10^{-288} \lor \neg \left(z \leq 1.081099186151696 \cdot 10^{-51}\right):\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot x}{t - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020253 
(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)))