Average Error: 11.6 → 1.5
Time: 5.2s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z} \]
\[\begin{array}{l} t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{if}\;t_1 \leq -7.365184855426764 \cdot 10^{+212}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\ \mathbf{elif}\;t_1 \leq 1.892476301148154 \cdot 10^{+261}:\\ \;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{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}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t_1 \leq -7.365184855426764 \cdot 10^{+212}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\

\mathbf{elif}\;t_1 \leq 1.892476301148154 \cdot 10^{+261}:\\
\;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\

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


\end{array}
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* x (- y z)) (- t z))))
   (if (<= t_1 -7.365184855426764e+212)
     (* (- y z) (/ x (- t z)))
     (if (<= t_1 1.892476301148154e+261)
       (- (/ (* x y) (- t z)) (/ (* x z) (- t z)))
       (/ x (/ (- t z) (- y 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 <= -7.365184855426764e+212) {
		tmp = (y - z) * (x / (t - z));
	} else if (t_1 <= 1.892476301148154e+261) {
		tmp = ((x * y) / (t - z)) - ((x * z) / (t - z));
	} else {
		tmp = x / ((t - z) / (y - 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.6
Target1.9
Herbie1.5
\[\frac{x}{\frac{t - z}{y - z}} \]

Derivation

  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -7.3651848554267645e212

    1. Initial program 48.7

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

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}} \]
    3. Applied div-inv_binary641.5

      \[\leadsto \frac{x}{\color{blue}{\left(t - z\right) \cdot \frac{1}{y - z}}} \]
    4. Applied associate-/r*_binary644.2

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{\frac{1}{y - z}}} \]
    5. Applied associate-/r/_binary644.1

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

    if -7.3651848554267645e212 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 1.892476301148154e261

    1. Initial program 1.3

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

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

    if 1.892476301148154e261 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z))

    1. Initial program 58.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{t - z} \leq -7.365184855426764 \cdot 10^{+212}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{t - z} \leq 1.892476301148154 \cdot 10^{+261}:\\ \;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \end{array} \]

Reproduce

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