Average Error: 11.2 → 2.3
Time: 3.2s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -5.681489408324378 \cdot 10^{-178}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \mathbf{elif}\;z \leq 1.482447504496303 \cdot 10^{-67}:\\ \;\;\;\;\frac{1}{\frac{t - z}{x \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 \leq -5.681489408324378 \cdot 10^{-178}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\

\mathbf{elif}\;z \leq 1.482447504496303 \cdot 10^{-67}:\\
\;\;\;\;\frac{1}{\frac{t - z}{x \cdot \left(y - z\right)}}\\

\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
 (if (<= z -5.681489408324378e-178)
   (/ x (/ (- t z) (- y z)))
   (if (<= z 1.482447504496303e-67)
     (/ 1.0 (/ (- t z) (* x (- y z))))
     (* 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 tmp;
	if (z <= -5.681489408324378e-178) {
		tmp = x / ((t - z) / (y - z));
	} else if (z <= 1.482447504496303e-67) {
		tmp = 1.0 / ((t - z) / (x * (y - z)));
	} 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

Original11.2
Target2.3
Herbie2.3
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -5.68148940832437786e-178

    1. Initial program 13.0

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

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

    if -5.68148940832437786e-178 < z < 1.48244750449630299e-67

    1. Initial program 5.7

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied clear-num_binary646.0

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

    if 1.48244750449630299e-67 < z

    1. Initial program 13.8

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

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

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

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

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

Reproduce

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