Average Error: 11.9 → 2.3
Time: 3.2s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1121188610291946 \cdot 10^{-285} \lor \neg \left(x \leq 5.094111444011304 \cdot 10^{+31}\right):\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
\mathbf{if}\;x \leq -2.1121188610291946 \cdot 10^{-285} \lor \neg \left(x \leq 5.094111444011304 \cdot 10^{+31}\right):\\
\;\;\;\;x \cdot \frac{y - z}{t - z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\

\end{array}
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -2.1121188610291946e-285) (not (<= x 5.094111444011304e+31)))
   (* x (/ (- y 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.1121188610291946e-285) || !(x <= 5.094111444011304e+31)) {
		tmp = x * ((y - 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.9
Target2.4
Herbie2.3
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -2.1121188610291946e-285 or 5.0941114440113043e31 < x

    1. Initial program 16.2

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

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

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

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

    if -2.1121188610291946e-285 < x < 5.0941114440113043e31

    1. Initial program 2.3

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1121188610291946 \cdot 10^{-285} \lor \neg \left(x \leq 5.094111444011304 \cdot 10^{+31}\right):\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{t - z}\\ \end{array}\]

Reproduce

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