Average Error: 2.4 → 1.1
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 -2.6992085356505333 \cdot 10^{-291}:\\ \;\;\;\;t \cdot \left(\frac{x}{z - y} - \frac{y}{z - y}\right)\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \leq -0:\\ \;\;\;\;\frac{1}{z - y} \cdot \left(\left(x - y\right) \cdot t\right)\\ \mathbf{elif}\;\frac{x - y}{z - y} \cdot t \leq 5.298243756140431 \cdot 10^{+257}:\\ \;\;\;\;t \cdot \left(\frac{x}{z - y} - \frac{y}{z - y}\right)\\ \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 \leq -2.6992085356505333 \cdot 10^{-291}:\\
\;\;\;\;t \cdot \left(\frac{x}{z - y} - \frac{y}{z - y}\right)\\

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

\mathbf{elif}\;\frac{x - y}{z - y} \cdot t \leq 5.298243756140431 \cdot 10^{+257}:\\
\;\;\;\;t \cdot \left(\frac{x}{z - y} - \frac{y}{z - y}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{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 (<= (* (/ (- x y) (- z y)) t) -2.6992085356505333e-291)
   (* t (- (/ x (- z y)) (/ y (- z y))))
   (if (<= (* (/ (- x y) (- z y)) t) -0.0)
     (* (/ 1.0 (- z y)) (* (- x y) t))
     (if (<= (* (/ (- x y) (- z y)) t) 5.298243756140431e+257)
       (* t (- (/ x (- z y)) (/ y (- z y))))
       (* (- x y) (/ t (- z y)))))))
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 tmp;
	if ((((double) ((((double) (x - y)) / ((double) (z - y))) * t)) <= -2.6992085356505333e-291)) {
		tmp = ((double) (t * ((double) ((x / ((double) (z - y))) - (y / ((double) (z - y)))))));
	} else {
		double tmp_1;
		if ((((double) ((((double) (x - y)) / ((double) (z - y))) * t)) <= -0.0)) {
			tmp_1 = ((double) ((1.0 / ((double) (z - y))) * ((double) (((double) (x - y)) * t))));
		} else {
			double tmp_2;
			if ((((double) ((((double) (x - y)) / ((double) (z - y))) * t)) <= 5.298243756140431e+257)) {
				tmp_2 = ((double) (t * ((double) ((x / ((double) (z - y))) - (y / ((double) (z - y)))))));
			} else {
				tmp_2 = ((double) (((double) (x - y)) * (t / ((double) (z - y)))));
			}
			tmp_1 = tmp_2;
		}
		tmp = tmp_1;
	}
	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.4
Target2.3
Herbie1.1
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 3 regimes
  2. if (* (/ (- x y) (- z y)) t) < -2.6992085356505333e-291 or -0.0 < (* (/ (- x y) (- z y)) t) < 5.2982437561404306e257

    1. Initial program Error: 1.0 bits

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied div-subError: 1.0 bits

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

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

    1. Initial program Error: 8.1 bits

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied div-subError: 8.1 bits

      \[\leadsto \color{blue}{\left(\frac{x}{z - y} - \frac{y}{z - y}\right)} \cdot t\]
    4. Using strategy rm
    5. Applied div-invError: 8.1 bits

      \[\leadsto \left(\frac{x}{z - y} - \color{blue}{y \cdot \frac{1}{z - y}}\right) \cdot t\]
    6. Applied div-invError: 8.1 bits

      \[\leadsto \left(\color{blue}{x \cdot \frac{1}{z - y}} - y \cdot \frac{1}{z - y}\right) \cdot t\]
    7. Applied distribute-rgt-out--Error: 8.1 bits

      \[\leadsto \color{blue}{\left(\frac{1}{z - y} \cdot \left(x - y\right)\right)} \cdot t\]
    8. Applied associate-*l*Error: 0.4 bits

      \[\leadsto \color{blue}{\frac{1}{z - y} \cdot \left(\left(x - y\right) \cdot t\right)}\]
    9. SimplifiedError: 0.4 bits

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

    if 5.2982437561404306e257 < (* (/ (- x y) (- z y)) t)

    1. Initial program Error: 15.2 bits

      \[\frac{x - y}{z - y} \cdot t\]
    2. SimplifiedError: 5.9 bits

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

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

Reproduce

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