Average Error: 2.1 → 0.9
Time: 3.8s
Precision: binary64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \leq -3.8891871544834074 \cdot 10^{-290} \lor \neg \left(\frac{x - y}{z - y} \leq 4.333138691589018 \cdot 10^{-85}\right) \land \frac{x - y}{z - y} \leq 1.2541601618600537 \cdot 10^{+269}:\\ \;\;\;\;\frac{x - y}{z - y} \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}\;\frac{x - y}{z - y} \leq -3.8891871544834074 \cdot 10^{-290} \lor \neg \left(\frac{x - y}{z - y} \leq 4.333138691589018 \cdot 10^{-85}\right) \land \frac{x - y}{z - y} \leq 1.2541601618600537 \cdot 10^{+269}:\\
\;\;\;\;\frac{x - y}{z - y} \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 (<= (/ (- x y) (- z y)) -3.8891871544834074e-290)
         (and (not (<= (/ (- x y) (- z y)) 4.333138691589018e-85))
              (<= (/ (- x y) (- z y)) 1.2541601618600537e+269)))
   (* (/ (- x y) (- z y)) t)
   (/ (* (- 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) (x - y)) / ((double) (z - y))) <= -3.8891871544834074e-290) || (!((((double) (x - y)) / ((double) (z - y))) <= 4.333138691589018e-85) && ((((double) (x - y)) / ((double) (z - y))) <= 1.2541601618600537e+269)))) {
		tmp = ((double) ((((double) (x - y)) / ((double) (z - y))) * t));
	} else {
		tmp = (((double) (((double) (x - y)) * t)) / ((double) (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.1
Target2.1
Herbie0.9
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 x y) (-.f64 z y)) < -3.88918715448340742e-290 or 4.33313869158901784e-85 < (/.f64 (-.f64 x y) (-.f64 z y)) < 1.25416016186005369e269

    1. Initial program 0.7

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

    if -3.88918715448340742e-290 < (/.f64 (-.f64 x y) (-.f64 z y)) < 4.33313869158901784e-85 or 1.25416016186005369e269 < (/.f64 (-.f64 x y) (-.f64 z y))

    1. Initial program 9.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \leq -3.8891871544834074 \cdot 10^{-290} \lor \neg \left(\frac{x - y}{z - y} \leq 4.333138691589018 \cdot 10^{-85}\right) \land \frac{x - y}{z - y} \leq 1.2541601618600537 \cdot 10^{+269}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z - y}\\ \end{array}\]

Reproduce

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