Average Error: 11.8 → 2.2
Time: 2.3s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.3996600186244516 \cdot 10^{-112}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{elif}\;z \le -2.1071166133089801 \cdot 10^{-274}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;z \le -3.3996600186244516 \cdot 10^{-112}:\\
\;\;\;\;x \cdot \frac{y - z}{t - z}\\

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

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

\end{array}
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 VAR;
	if ((z <= -3.3996600186244516e-112)) {
		VAR = (x * ((y - z) / (t - z)));
	} else {
		double VAR_1;
		if ((z <= -2.10711661330898e-274)) {
			VAR_1 = ((x * (y - z)) / (t - z));
		} else {
			VAR_1 = (x / ((t - z) / (y - z)));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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

Derivation

  1. Split input into 3 regimes
  2. if z < -3.3996600186244516e-112

    1. Initial program 14.5

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

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}}\]
    4. Using strategy rm
    5. Applied div-inv0.9

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

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

    if -3.3996600186244516e-112 < z < -2.10711661330898e-274

    1. Initial program 5.8

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

    if -2.10711661330898e-274 < z

    1. Initial program 11.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.3996600186244516 \cdot 10^{-112}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{elif}\;z \le -2.1071166133089801 \cdot 10^{-274}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \end{array}\]

Reproduce

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