Average Error: 2.2 → 1.3
Time: 3.7s
Precision: binary64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \le -1.7380019105215449 \cdot 10^{-295}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{elif}\;\frac{x - y}{z - y} \le 2.3991963319781 \cdot 10^{-312}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \le -1.7380019105215449 \cdot 10^{-295}:\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\

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

\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (((double) (((double) (x - y)) / ((double) (z - y)))) * t));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((((double) (((double) (x - y)) / ((double) (z - y)))) <= -1.738001910521545e-295)) {
		VAR = ((double) (((double) (((double) (x - y)) / ((double) (z - y)))) * t));
	} else {
		double VAR_1;
		if ((((double) (((double) (x - y)) / ((double) (z - y)))) <= 2.3991963319781e-312)) {
			VAR_1 = ((double) (((double) (x - y)) * ((double) (t / ((double) (z - y))))));
		} else {
			VAR_1 = ((double) (t / ((double) (((double) (z - y)) / ((double) (x - y))))));
		}
		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.2
Herbie1.3
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (- x y) (- z y)) < -1.7380019105215449e-295

    1. Initial program 2.2

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

    if -1.7380019105215449e-295 < (/ (- x y) (- z y)) < 2.3991963319781e-312

    1. Initial program 19.6

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

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

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

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

    if 2.3991963319781e-312 < (/ (- x y) (- z y))

    1. Initial program 1.0

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \cdot t\]
    4. Using strategy rm
    5. Applied associate-*l/1.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \le -1.7380019105215449 \cdot 10^{-295}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{elif}\;\frac{x - y}{z - y} \le 2.3991963319781 \cdot 10^{-312}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \end{array}\]

Reproduce

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