Average Error: 12.0 → 1.3
Time: 4.4s
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 -\infty:\\ \;\;\;\;x \cdot \left(\left(y - z\right) \cdot \frac{1}{t - z}\right)\\ \mathbf{elif}\;t_1 \leq -2.77817195028 \cdot 10^{-312}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{t - 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 -\infty:\\
\;\;\;\;x \cdot \left(\left(y - z\right) \cdot \frac{1}{t - z}\right)\\

\mathbf{elif}\;t_1 \leq -2.77817195028 \cdot 10^{-312}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y - z}{t - 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 (- INFINITY))
     (* x (* (- y z) (/ 1.0 (- t z))))
     (if (<= t_1 -2.77817195028e-312) t_1 (* x (/ (- y 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 <= -((double) INFINITY)) {
		tmp = x * ((y - z) * (1.0 / (t - z)));
	} else if (t_1 <= -2.77817195028e-312) {
		tmp = t_1;
	} else {
		tmp = x * ((y - 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

Original12.0
Target2.1
Herbie1.3
\[\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)) < -inf.0

    1. Initial program 64.0

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

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

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

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

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

    if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -2.7781719502808e-312

    1. Initial program 0.3

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y - z}{t - z} \]
    5. Taylor expanded in x around 0 0.3

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

    if -2.7781719502808e-312 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z))

    1. Initial program 11.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{t - z} \leq -\infty:\\ \;\;\;\;x \cdot \left(\left(y - z\right) \cdot \frac{1}{t - z}\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{t - z} \leq -2.77817195028 \cdot 10^{-312}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \end{array} \]

Reproduce

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