Average Error: 11.4 → 2.2
Time: 5.4s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.39134914018148016 \cdot 10^{-213}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{elif}\;z \le 0.0025719360646465723:\\ \;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\ \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}\;z \le -1.39134914018148016 \cdot 10^{-213}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\

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

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y - z}{t - 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 <= -1.3913491401814802e-213)) {
		VAR = (x / ((t - z) / (y - z)));
	} else {
		double VAR_1;
		if ((z <= 0.0025719360646465723)) {
			VAR_1 = ((x / (t - z)) * (y - z));
		} else {
			VAR_1 = (x * ((y - z) / (t - 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.4
Target2.1
Herbie2.2
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -1.3913491401814802e-213

    1. Initial program 12.6

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

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

    if -1.3913491401814802e-213 < z < 0.0025719360646465723

    1. Initial program 5.2

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

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

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

    if 0.0025719360646465723 < z

    1. Initial program 16.7

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

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

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

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

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

Reproduce

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