Average Error: 11.7 → 1.5
Time: 4.2s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z} \]
\[\begin{array}{l} \mathbf{if}\;\begin{array}{l} t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\ t_1 \leq 0 \lor \neg \left(t_1 \leq 5.022756205473603 \cdot 10^{+222}\right) \end{array}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\ \end{array} \]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
t_1 \leq 0 \lor \neg \left(t_1 \leq 5.022756205473603 \cdot 10^{+222}\right)
\end{array}:\\
\;\;\;\;x \cdot \frac{y - z}{t - z}\\

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


\end{array}
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
 :precision binary64
 (if (let* ((t_1 (/ (* x (- y z)) (- t z))))
       (or (<= t_1 0.0) (not (<= t_1 5.022756205473603e+222))))
   (* x (/ (- y z) (- t z)))
   (- (/ (* x y) (- t z)) (/ (* x z) (- 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 t_1 = (x * (y - z)) / (t - z);
	double tmp;
	if ((t_1 <= 0.0) || !(t_1 <= 5.022756205473603e+222)) {
		tmp = x * ((y - z) / (t - z));
	} else {
		tmp = ((x * y) / (t - z)) - ((x * z) / (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.7
Target2.3
Herbie1.5
\[\frac{x}{\frac{t - z}{y - z}} \]

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -0.0 or 5.02275620547360281e222 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z))

    1. Initial program 17.5

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Applied *-un-lft-identity_binary6417.5

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

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

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

    if -0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 5.02275620547360281e222

    1. Initial program 0.3

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Taylor expanded in y around 0 0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{t - z} \leq 0 \lor \neg \left(\frac{x \cdot \left(y - z\right)}{t - z} \leq 5.022756205473603 \cdot 10^{+222}\right):\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\ \end{array} \]

Reproduce

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