Average Error: 2.1 → 0.9
Time: 5.6s
Precision: binary64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \le -5.86205391743587306 \cdot 10^{-208} \lor \neg \left(\frac{x}{y} \le 1.7162730782331399 \cdot 10^{-224} \lor \neg \left(\frac{x}{y} \le 1.76816687855064651 \cdot 10^{194}\right)\right):\\ \;\;\;\;\frac{x}{y} \cdot z + \left(t - t \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y} + t\\ \end{array}\]
\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \le -5.86205391743587306 \cdot 10^{-208} \lor \neg \left(\frac{x}{y} \le 1.7162730782331399 \cdot 10^{-224} \lor \neg \left(\frac{x}{y} \le 1.76816687855064651 \cdot 10^{194}\right)\right):\\
\;\;\;\;\frac{x}{y} \cdot z + \left(t - t \cdot \frac{x}{y}\right)\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (((double) (((double) (x / y)) * ((double) (z - t)))) + t));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((((double) (x / y)) <= -5.862053917435873e-208) || !((((double) (x / y)) <= 1.71627307823314e-224) || !(((double) (x / y)) <= 1.7681668785506465e+194)))) {
		VAR = ((double) (((double) (((double) (x / y)) * z)) + ((double) (t - ((double) (t * ((double) (x / y))))))));
	} else {
		VAR = ((double) (((double) (((double) (x * ((double) (z - t)))) * ((double) (1.0 / y)))) + t));
	}
	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.1
Target2.3
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;z \lt 2.7594565545626922 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z \lt 2.326994450874436 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ x y) < -5.86205391743587306e-208 or 1.7162730782331399e-224 < (/ x y) < 1.76816687855064651e194

    1. Initial program 1.1

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied sub-neg1.1

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(z + \left(-t\right)\right)} + t\]
    4. Applied distribute-lft-in1.1

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

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

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

    if -5.86205391743587306e-208 < (/ x y) < 1.7162730782331399e-224 or 1.76816687855064651e194 < (/ x y)

    1. Initial program 4.1

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied div-inv4.1

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

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

      \[\leadsto x \cdot \color{blue}{\frac{z - t}{y}} + t\]
    6. Using strategy rm
    7. Applied div-inv0.7

      \[\leadsto x \cdot \color{blue}{\left(\left(z - t\right) \cdot \frac{1}{y}\right)} + t\]
    8. Applied associate-*r*0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \le -5.86205391743587306 \cdot 10^{-208} \lor \neg \left(\frac{x}{y} \le 1.7162730782331399 \cdot 10^{-224} \lor \neg \left(\frac{x}{y} \le 1.76816687855064651 \cdot 10^{194}\right)\right):\\ \;\;\;\;\frac{x}{y} \cdot z + \left(t - t \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y} + t\\ \end{array}\]

Reproduce

herbie shell --seed 2020168 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

  (+ (* (/ x y) (- z t)) t))