Average Error: 1.9 → 1.0
Time: 3.8s
Precision: binary64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \le -4.52641419959651135 \cdot 10^{207}:\\ \;\;\;\;t + \left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y}\\ \mathbf{elif}\;\frac{x}{y} \le -2.748550332250791 \cdot 10^{-156} \lor \neg \left(\frac{x}{y} \le 2.75702788663815959 \cdot 10^{-196}\right):\\ \;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\ \end{array}\]
\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \le -4.52641419959651135 \cdot 10^{207}:\\
\;\;\;\;t + \left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y}\\

\mathbf{elif}\;\frac{x}{y} \le -2.748550332250791 \cdot 10^{-156} \lor \neg \left(\frac{x}{y} \le 2.75702788663815959 \cdot 10^{-196}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\

\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z - 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)) <= -4.5264141995965114e+207)) {
		VAR = ((double) (t + ((double) (((double) (x * ((double) (z - t)))) * ((double) (1.0 / y))))));
	} else {
		double VAR_1;
		if (((((double) (x / y)) <= -2.7485503322507914e-156) || !(((double) (x / y)) <= 2.7570278866381596e-196))) {
			VAR_1 = ((double) (t + ((double) (((double) (x / y)) * ((double) (z - t))))));
		} else {
			VAR_1 = ((double) (t + ((double) (x / ((double) (y / ((double) (z - t))))))));
		}
		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

Original1.9
Target2.1
Herbie1.0
\[\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 3 regimes
  2. if (/ x y) < -4.52641419959651135e207

    1. Initial program 18.7

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied associate-*l/1.7

      \[\leadsto \color{blue}{\frac{x \cdot \left(z - t\right)}{y}} + t\]
    4. Using strategy rm
    5. Applied div-inv1.8

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

    if -4.52641419959651135e207 < (/ x y) < -2.748550332250791e-156 or 2.75702788663815959e-196 < (/ x y)

    1. Initial program 1.2

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

    if -2.748550332250791e-156 < (/ x y) < 2.75702788663815959e-196

    1. Initial program 1.7

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied associate-*l/0.9

      \[\leadsto \color{blue}{\frac{x \cdot \left(z - t\right)}{y}} + t\]
    4. Using strategy rm
    5. Applied associate-/l*0.6

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{z - t}}} + t\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \le -4.52641419959651135 \cdot 10^{207}:\\ \;\;\;\;t + \left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y}\\ \mathbf{elif}\;\frac{x}{y} \le -2.748550332250791 \cdot 10^{-156} \lor \neg \left(\frac{x}{y} \le 2.75702788663815959 \cdot 10^{-196}\right):\\ \;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\ \end{array}\]

Reproduce

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