Average Error: 2.0 → 2.2
Time: 7.2s
Precision: binary64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \leq -8.349810058626823 \cdot 10^{-203} \lor \neg \left(y \leq 3.2326137485667516 \cdot 10^{-41}\right):\\ \;\;\;\;\left(\left(x - y\right) \cdot \frac{1}{z - y}\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \leq -8.349810058626823 \cdot 10^{-203} \lor \neg \left(y \leq 3.2326137485667516 \cdot 10^{-41}\right):\\
\;\;\;\;\left(\left(x - y\right) \cdot \frac{1}{z - y}\right) \cdot t\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -8.349810058626823e-203) (not (<= y 3.2326137485667516e-41)))
   (* (* (- x y) (/ 1.0 (- z y))) t)
   (/ (* (- x y) t) (- z y))))
double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * t;
}
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -8.349810058626823e-203) || !(y <= 3.2326137485667516e-41)) {
		tmp = ((x - y) * (1.0 / (z - y))) * t;
	} else {
		tmp = ((x - y) * t) / (z - y);
	}
	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

Original2.0
Target2.0
Herbie2.2
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -8.34986e-203 or 3.23259e-41 < y

    1. Initial program 0.8

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied div-inv_binary64_50690.9

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

    if -8.34986e-203 < y < 3.23259e-41

    1. Initial program 5.0

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied associate-*l/_binary64_51305.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.349810058626823 \cdot 10^{-203} \lor \neg \left(y \leq 3.2326137485667516 \cdot 10^{-41}\right):\\ \;\;\;\;\left(\left(x - y\right) \cdot \frac{1}{z - y}\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020231 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (/ t (/ (- z y) (- x y)))

  (* (/ (- x y) (- z y)) t))