Average Error: 11.7 → 2.1
Time: 5.4s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -4.9940661561368986 \cdot 10^{+17}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{elif}\;x \leq 3.185382957686135 \cdot 10^{-242}:\\ \;\;\;\;\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}
\mathbf{if}\;x \leq -4.9940661561368986 \cdot 10^{+17}:\\
\;\;\;\;x \cdot \frac{y - z}{t - z}\\

\mathbf{elif}\;x \leq 3.185382957686135 \cdot 10^{-242}:\\
\;\;\;\;\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
 (if (<= x -4.9940661561368986e+17)
   (* x (/ (- y z) (- t z)))
   (if (<= x 3.185382957686135e-242)
     (- (/ (* 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 tmp;
	if (x <= -4.9940661561368986e+17) {
		tmp = x * ((y - z) / (t - z));
	} else if (x <= 3.185382957686135e-242) {
		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.7
Target2.1
Herbie2.1
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -499406615613689900

    1. Initial program 25.0

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

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

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

    if -499406615613689900 < x < 3.1853829576861352e-242

    1. Initial program 2.1

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

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

    if 3.1853829576861352e-242 < x

    1. Initial program 12.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.9940661561368986 \cdot 10^{+17}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{elif}\;x \leq 3.185382957686135 \cdot 10^{-242}:\\ \;\;\;\;\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 2021174 
(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)))