Average Error: 2.2 → 1.6
Time: 3.7s
Precision: binary64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t \leq -4.246092202844289 \cdot 10^{+25}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \leq -0:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(\frac{x}{z - y} - \frac{y}{z - y}\right)\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \cdot t \leq -4.246092202844289 \cdot 10^{+25}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\

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

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

\end{array}
double code(double x, double y, double z, double t) {
	return ((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))) * t)) <= -4.246092202844289e+25)) {
		VAR = ((double) (((double) (x - y)) * (t / ((double) (z - y)))));
	} else {
		double VAR_1;
		if ((((double) ((((double) (x - y)) / ((double) (z - y))) * t)) <= -0.0)) {
			VAR_1 = (((double) (((double) (x - y)) * t)) / ((double) (z - y)));
		} else {
			VAR_1 = ((double) (t * ((double) ((x / ((double) (z - y))) - (y / ((double) (z - 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.3
Herbie1.6
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 3 regimes
  2. if (* (/ (- x y) (- z y)) t) < -4.24609220284428913e25

    1. Initial program 2.7

      \[\frac{x - y}{z - y} \cdot t\]
    2. Simplified2.4

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

    if -4.24609220284428913e25 < (* (/ (- x y) (- z y)) t) < -0.0

    1. Initial program 2.9

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

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

    if -0.0 < (* (/ (- x y) (- z y)) t)

    1. Initial program 1.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t \leq -4.246092202844289 \cdot 10^{+25}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \leq -0:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(\frac{x}{z - y} - \frac{y}{z - y}\right)\\ \end{array}\]

Reproduce

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