Average Error: 2.3 → 2.4
Time: 3.6s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -8.5735405728985964 \cdot 10^{-251} \lor \neg \left(y \le 1.4643699871055045 \cdot 10^{-31}\right):\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z - y} \cdot \left(t \cdot \left(x - y\right)\right)\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -8.5735405728985964 \cdot 10^{-251} \lor \neg \left(y \le 1.4643699871055045 \cdot 10^{-31}\right):\\
\;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\

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

\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 (((y <= -8.573540572898596e-251) || !(y <= 1.4643699871055045e-31))) {
		VAR = ((double) (t / ((double) (((double) (z - y)) / ((double) (x - y))))));
	} else {
		VAR = ((double) (((double) (1.0 / ((double) (z - y)))) * ((double) (t * ((double) (x - y))))));
	}
	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.3
Target2.3
Herbie2.4
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -8.573540572898596e-251 or 1.4643699871055045e-31 < y

    1. Initial program 1.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \cdot t\]
    4. Applied associate-*l/1.3

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

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

    if -8.573540572898596e-251 < y < 1.4643699871055045e-31

    1. Initial program 5.2

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

      \[\leadsto \color{blue}{\left(\left(x - y\right) \cdot \frac{1}{z - y}\right)} \cdot t\]
    4. Using strategy rm
    5. Applied *-commutative5.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -8.5735405728985964 \cdot 10^{-251} \lor \neg \left(y \le 1.4643699871055045 \cdot 10^{-31}\right):\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z - y} \cdot \left(t \cdot \left(x - y\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020113 +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))