Average Error: 2.2 → 1.5
Time: 6.3s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t = -\infty:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -8.1264346714564075 \cdot 10^{-265}:\\ \;\;\;\;\frac{1}{\frac{z - y}{x - y}} \cdot t\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le 8.5183233934805411 \cdot 10^{-33}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \cdot t = -\infty:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\

\mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -8.1264346714564075 \cdot 10^{-265}:\\
\;\;\;\;\frac{1}{\frac{z - y}{x - y}} \cdot t\\

\mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le 8.5183233934805411 \cdot 10^{-33}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\

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

\end{array}
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 VAR;
	if (((((x - y) / (z - y)) * t) <= -inf.0)) {
		VAR = ((x - y) * (t / (z - y)));
	} else {
		double VAR_1;
		if (((((x - y) / (z - y)) * t) <= -8.126434671456407e-265)) {
			VAR_1 = ((1.0 / ((z - y) / (x - y))) * t);
		} else {
			double VAR_2;
			if (((((x - y) / (z - y)) * t) <= 8.518323393480541e-33)) {
				VAR_2 = (((x - y) * t) / (z - y));
			} else {
				VAR_2 = ((x - y) * (t / (z - y)));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.2
Target2.1
Herbie1.5
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 3 regimes
  2. if (* (/ (- x y) (- z y)) t) < -inf.0 or 8.518323393480541e-33 < (* (/ (- x y) (- z y)) t)

    1. Initial program 3.8

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

      \[\leadsto \color{blue}{\left(\left(x - y\right) \cdot \frac{1}{z - y}\right)} \cdot t\]
    4. Applied associate-*l*2.6

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

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

    if -inf.0 < (* (/ (- x y) (- z y)) t) < -8.126434671456407e-265

    1. Initial program 0.2

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied clear-num0.4

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

    if -8.126434671456407e-265 < (* (/ (- x y) (- z y)) t) < 8.518323393480541e-33

    1. Initial program 3.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t = -\infty:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le -8.1264346714564075 \cdot 10^{-265}:\\ \;\;\;\;\frac{1}{\frac{z - y}{x - y}} \cdot t\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \le 8.5183233934805411 \cdot 10^{-33}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020105 +o rules:numerics
(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))