Average Error: 2.3 → 2.4
Time: 5.5s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -9.3910125961314414 \cdot 10^{-161} \lor \neg \left(y \le 6.0401320354982989 \cdot 10^{-75}\right):\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{1}}{1} \cdot \left(\left(x - y\right) \cdot \frac{t}{z - y}\right)\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -9.3910125961314414 \cdot 10^{-161} \lor \neg \left(y \le 6.0401320354982989 \cdot 10^{-75}\right):\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\

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

\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 temp;
	if (((y <= -9.391012596131441e-161) || !(y <= 6.040132035498299e-75))) {
		temp = (((x - y) / (z - y)) * t);
	} else {
		temp = ((sqrt(1.0) / 1.0) * ((x - y) * (t / (z - y))));
	}
	return temp;
}

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 < -9.391012596131441e-161 or 6.040132035498299e-75 < y

    1. Initial program 1.0

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

    if -9.391012596131441e-161 < y < 6.040132035498299e-75

    1. Initial program 5.7

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \cdot t\]
    4. Using strategy rm
    5. Applied *-un-lft-identity6.1

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{z - y}{x - y}}} \cdot t\]
    8. Applied add-sqr-sqrt6.1

      \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{\frac{1}{1} \cdot \frac{z - y}{x - y}} \cdot t\]
    9. Applied times-frac6.1

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

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

      \[\leadsto \frac{\sqrt{1}}{\frac{1}{1}} \cdot \color{blue}{\frac{t}{\frac{z - y}{x - y}}}\]
    12. Using strategy rm
    13. Applied div-sub5.7

      \[\leadsto \frac{\sqrt{1}}{\frac{1}{1}} \cdot \frac{t}{\color{blue}{\frac{z}{x - y} - \frac{y}{x - y}}}\]
    14. Using strategy rm
    15. Applied div-inv5.7

      \[\leadsto \frac{\sqrt{1}}{\frac{1}{1}} \cdot \frac{t}{\frac{z}{x - y} - \color{blue}{y \cdot \frac{1}{x - y}}}\]
    16. Applied div-inv5.7

      \[\leadsto \frac{\sqrt{1}}{\frac{1}{1}} \cdot \frac{t}{\color{blue}{z \cdot \frac{1}{x - y}} - y \cdot \frac{1}{x - y}}\]
    17. Applied distribute-rgt-out--5.7

      \[\leadsto \frac{\sqrt{1}}{\frac{1}{1}} \cdot \frac{t}{\color{blue}{\frac{1}{x - y} \cdot \left(z - y\right)}}\]
    18. Applied *-un-lft-identity5.7

      \[\leadsto \frac{\sqrt{1}}{\frac{1}{1}} \cdot \frac{\color{blue}{1 \cdot t}}{\frac{1}{x - y} \cdot \left(z - y\right)}\]
    19. Applied times-frac6.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -9.3910125961314414 \cdot 10^{-161} \lor \neg \left(y \le 6.0401320354982989 \cdot 10^{-75}\right):\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{1}}{1} \cdot \left(\left(x - y\right) \cdot \frac{t}{z - y}\right)\\ \end{array}\]

Reproduce

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