Average Error: 2.1 → 1.5
Time: 3.1s
Precision: 64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.33382713260983171 \cdot 10^{-76}:\\ \;\;\;\;\frac{x}{\frac{y}{z - t}} + t\\ \mathbf{elif}\;x \le 1704346938201990.25:\\ \;\;\;\;\frac{x \cdot \left(z - t\right)}{y} + t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \end{array}\]
\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;x \le -3.33382713260983171 \cdot 10^{-76}:\\
\;\;\;\;\frac{x}{\frac{y}{z - t}} + t\\

\mathbf{elif}\;x \le 1704346938201990.25:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y} + t\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return (((x / y) * (z - t)) + t);
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((x <= -3.333827132609832e-76)) {
		VAR = ((x / (y / (z - t))) + t);
	} else {
		double VAR_1;
		if ((x <= 1704346938201990.2)) {
			VAR_1 = (((x * (z - t)) / y) + t);
		} else {
			VAR_1 = ((x * ((z - t) / y)) + 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

Original2.1
Target2.5
Herbie1.5
\[\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 < -3.333827132609832e-76

    1. Initial program 2.9

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

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

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

    if -3.333827132609832e-76 < x < 1704346938201990.2

    1. Initial program 1.3

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

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

    if 1704346938201990.2 < x

    1. Initial program 3.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -3.33382713260983171 \cdot 10^{-76}:\\ \;\;\;\;\frac{x}{\frac{y}{z - t}} + t\\ \mathbf{elif}\;x \le 1704346938201990.25:\\ \;\;\;\;\frac{x \cdot \left(z - t\right)}{y} + t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \end{array}\]

Reproduce

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