Average Error: 2.0 → 2.0
Time: 7.4s
Precision: binary64
\[\frac{x - y}{z - y} \cdot t \]
\[\begin{array}{l} \mathbf{if}\;y \leq -1.888243183884543 \cdot 10^{-104}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \mathbf{elif}\;y \leq 6.6024302915393845 \cdot 10^{-292}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x - y}{z - y}\\ \end{array} \]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \leq -1.888243183884543 \cdot 10^{-104}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\

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

\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x - y}{z - y}\\


\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.888243183884543e-104)
   (/ t (/ (- z y) (- x y)))
   (if (<= y 6.6024302915393845e-292)
     (* (- x y) (/ t (- z y)))
     (* t (/ (- x y) (- z y))))))
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 tmp;
	if (y <= -1.888243183884543e-104) {
		tmp = t / ((z - y) / (x - y));
	} else if (y <= 6.6024302915393845e-292) {
		tmp = (x - y) * (t / (z - y));
	} else {
		tmp = t * ((x - y) / (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.0
Target2.0
Herbie2.0
\[\frac{t}{\frac{z - y}{x - y}} \]

Derivation

  1. Split input into 3 regimes
  2. if y < -1.8882431838845431e-104

    1. Initial program 0.5

      \[\frac{x - y}{z - y} \cdot t \]
    2. Applied clear-num_binary640.6

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

      \[\leadsto \color{blue}{\frac{1 \cdot t}{\frac{z - y}{x - y}}} \]
    4. Simplified0.6

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

    if -1.8882431838845431e-104 < y < 6.6024302915393845e-292

    1. Initial program 5.7

      \[\frac{x - y}{z - y} \cdot t \]
    2. Applied div-inv_binary645.8

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

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

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

    if 6.6024302915393845e-292 < y

    1. Initial program 1.7

      \[\frac{x - y}{z - y} \cdot t \]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.888243183884543 \cdot 10^{-104}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \mathbf{elif}\;y \leq 6.6024302915393845 \cdot 10^{-292}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x - y}{z - y}\\ \end{array} \]

Reproduce

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