Average Error: 2.4 → 1.5
Time: 3.8s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \le -1.8737237687632686 \cdot 10^{-150}:\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \mathbf{elif}\;\frac{x - y}{z - y} \le -0.0:\\ \;\;\;\;{\left(\frac{\frac{t}{z - y}}{\frac{1}{x - y}}\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{t}{\frac{z - y}{x - y}}\right)}^{1}\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \le -1.8737237687632686 \cdot 10^{-150}:\\
\;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\

\mathbf{elif}\;\frac{x - y}{z - y} \le -0.0:\\
\;\;\;\;{\left(\frac{\frac{t}{z - y}}{\frac{1}{x - y}}\right)}^{1}\\

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

\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 ((((x - y) / (z - y)) <= -1.8737237687632686e-150)) {
		VAR = (((x / (z - y)) - (y / (z - y))) * t);
	} else {
		double VAR_1;
		if ((((x - y) / (z - y)) <= -0.0)) {
			VAR_1 = pow(((t / (z - y)) / (1.0 / (x - y))), 1.0);
		} else {
			VAR_1 = pow((t / ((z - y) / (x - y))), 1.0);
		}
		VAR = VAR_1;
	}
	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.4
Target2.4
Herbie1.5
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (- x y) (- z y)) < -1.8737237687632686e-150

    1. Initial program 2.6

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

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

    if -1.8737237687632686e-150 < (/ (- x y) (- z y)) < -0.0

    1. Initial program 10.3

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \cdot t\]
    4. Using strategy rm
    5. Applied pow110.9

      \[\leadsto \frac{1}{\frac{z - y}{x - y}} \cdot \color{blue}{{t}^{1}}\]
    6. Applied pow110.9

      \[\leadsto \color{blue}{{\left(\frac{1}{\frac{z - y}{x - y}}\right)}^{1}} \cdot {t}^{1}\]
    7. Applied pow-prod-down10.9

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

      \[\leadsto {\color{blue}{\left(\frac{t}{\frac{z - y}{x - y}}\right)}}^{1}\]
    9. Using strategy rm
    10. Applied div-inv10.9

      \[\leadsto {\left(\frac{t}{\color{blue}{\left(z - y\right) \cdot \frac{1}{x - y}}}\right)}^{1}\]
    11. Applied associate-/r*1.4

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

    if -0.0 < (/ (- x y) (- z y))

    1. Initial program 1.1

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \cdot t\]
    4. Using strategy rm
    5. Applied pow11.2

      \[\leadsto \frac{1}{\frac{z - y}{x - y}} \cdot \color{blue}{{t}^{1}}\]
    6. Applied pow11.2

      \[\leadsto \color{blue}{{\left(\frac{1}{\frac{z - y}{x - y}}\right)}^{1}} \cdot {t}^{1}\]
    7. Applied pow-prod-down1.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \le -1.8737237687632686 \cdot 10^{-150}:\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \mathbf{elif}\;\frac{x - y}{z - y} \le -0.0:\\ \;\;\;\;{\left(\frac{\frac{t}{z - y}}{\frac{1}{x - y}}\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{t}{\frac{z - y}{x - y}}\right)}^{1}\\ \end{array}\]

Reproduce

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