Average Error: 1.9 → 2.1
Time: 5.8s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.10161183992180506 \cdot 10^{-119} \lor \neg \left(y \le 2.03985428235322297 \cdot 10^{-95}\right):\\ \;\;\;\;\left(\left(x - y\right) \cdot \frac{1}{z - y}\right) \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}\;y \le -1.10161183992180506 \cdot 10^{-119} \lor \neg \left(y \le 2.03985428235322297 \cdot 10^{-95}\right):\\
\;\;\;\;\left(\left(x - y\right) \cdot \frac{1}{z - y}\right) \cdot t\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return (((x - y) / (z - y)) * t);
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((y <= -1.101611839921805e-119) || !(y <= 2.039854282353223e-95))) {
		VAR = (((x - y) * (1.0 / (z - y))) * t);
	} else {
		VAR = (((x - y) * t) / (z - 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

Original1.9
Target1.9
Herbie2.1
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -1.101611839921805e-119 or 2.039854282353223e-95 < y

    1. Initial program 0.6

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

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

    if -1.101611839921805e-119 < y < 2.039854282353223e-95

    1. Initial program 5.0

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

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

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

Reproduce

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