Average Error: 11.5 → 2.1
Time: 5.7s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z} \]
\[\begin{array}{l} \mathbf{if}\;x \leq -2.464627712927991 \cdot 10^{-49}:\\ \;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\ \mathbf{elif}\;x \leq -9.604018982582673 \cdot 10^{-297}:\\ \;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\ \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}\;x \leq -2.464627712927991 \cdot 10^{-49}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\

\mathbf{elif}\;x \leq -9.604018982582673 \cdot 10^{-297}:\\
\;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\

\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 (<= x -2.464627712927991e-49)
   (* (/ x (- t z)) (- y z))
   (if (<= x -9.604018982582673e-297)
     (- (/ (* x y) (- t z)) (/ (* x z) (- t 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 (x <= -2.464627712927991e-49) {
		tmp = (x / (t - z)) * (y - z);
	} else if (x <= -9.604018982582673e-297) {
		tmp = ((x * y) / (t - z)) - ((x * z) / (t - 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.5
Target2.0
Herbie2.1
\[\frac{x}{\frac{t - z}{y - z}} \]

Derivation

  1. Split input into 3 regimes
  2. if x < -2.46462771292799119e-49

    1. Initial program 19.6

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

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}} \]
    3. Applied associate-/r/_binary642.6

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

    if -2.46462771292799119e-49 < x < -9.6040189825826731e-297

    1. Initial program 1.8

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

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

    if -9.6040189825826731e-297 < x

    1. Initial program 11.2

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

      \[\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 simplification2.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.464627712927991 \cdot 10^{-49}:\\ \;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\ \mathbf{elif}\;x \leq -9.604018982582673 \cdot 10^{-297}:\\ \;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \end{array} \]

Reproduce

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