Average Error: 2.1 → 1.7
Time: 7.7s
Precision: binary64
Cost: 14146
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1433554134386932 \cdot 10^{+53}:\\ \;\;\;\;t + x \cdot \frac{z - t}{y}\\ \mathbf{elif}\;x \leq 2.865953165408925 \cdot 10^{-142}:\\ \;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;t + \sqrt{x} \cdot \left(\left(z - t\right) \cdot \frac{\sqrt{x}}{y}\right)\\ \end{array}\]
\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;x \leq -1.1433554134386932 \cdot 10^{+53}:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\

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

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t)
 :precision binary64
 (if (<= x -1.1433554134386932e+53)
   (+ t (* x (/ (- z t) y)))
   (if (<= x 2.865953165408925e-142)
     (+ t (/ (* x (- z t)) y))
     (+ t (* (sqrt x) (* (- z t) (/ (sqrt x) y)))))))
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 tmp;
	if (x <= -1.1433554134386932e+53) {
		tmp = t + (x * ((z - t) / y));
	} else if (x <= 2.865953165408925e-142) {
		tmp = t + ((x * (z - t)) / y);
	} else {
		tmp = t + (sqrt(x) * ((z - t) * (sqrt(x) / 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.1
Target2.4
Herbie1.7
\[\begin{array}{l} \mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z < 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}\]

Alternatives

Alternative 1
Error1.0
Cost39488
\[t + \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\left(z - t\right) \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)\]
Alternative 2
Error2.3
Cost904
\[\begin{array}{l} \mathbf{if}\;t \leq -6.667719697891982 \cdot 10^{-237} \lor \neg \left(t \leq 65.11818647907415\right):\\ \;\;\;\;t + \left(z - t\right) \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t + x \cdot \frac{z - t}{y}\\ \end{array}\]
Alternative 3
Error2.1
Cost904
\[\begin{array}{l} \mathbf{if}\;t \leq -1.0202177048941519 \cdot 10^{-231} \lor \neg \left(t \leq 2.755990980513582 \cdot 10^{-40}\right):\\ \;\;\;\;t + \left(z - t\right) \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\ \end{array}\]
Alternative 4
Error4.1
Cost1411
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1955743337116705 \cdot 10^{+162}:\\ \;\;\;\;t + z \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 1.3383586845609138 \cdot 10^{+133}:\\ \;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\ \mathbf{elif}\;y \leq 2.4907670670592365 \cdot 10^{+291}:\\ \;\;\;\;t + z \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x \cdot z}{y}\\ \end{array}\]
Alternative 5
Error11.9
Cost2783
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2.040321723568815 \cdot 10^{+235}:\\ \;\;\;\;t + \frac{x \cdot z}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -5.824986865728011 \cdot 10^{+122} \lor \neg \left(\frac{x}{y} \leq -9.72387445030468 \cdot 10^{+59}\right) \land \left(\frac{x}{y} \leq -6.2419983509129535 \lor \neg \left(\frac{x}{y} \leq 7268750.824016971\right) \land \left(\frac{x}{y} \leq 2.689868719198457 \cdot 10^{+70} \lor \neg \left(\frac{x}{y} \leq 2.6405699885379367 \cdot 10^{+106}\right) \land \frac{x}{y} \leq 6.47280637921352 \cdot 10^{+128}\right)\right):\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t + z \cdot \frac{x}{y}\\ \end{array}\]
Alternative 6
Error12.8
Cost2783
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2.040321723568815 \cdot 10^{+235}:\\ \;\;\;\;t + \frac{x \cdot z}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -5.824986865728011 \cdot 10^{+122} \lor \neg \left(\frac{x}{y} \leq -9.72387445030468 \cdot 10^{+59}\right) \land \left(\frac{x}{y} \leq -6.2419983509129535 \lor \neg \left(\frac{x}{y} \leq 7268750.824016971\right) \land \left(\frac{x}{y} \leq 2.689868719198457 \cdot 10^{+70} \lor \neg \left(\frac{x}{y} \leq 2.6405699885379367 \cdot 10^{+106}\right) \land \frac{x}{y} \leq 6.47280637921352 \cdot 10^{+128}\right)\right):\\ \;\;\;\;t - \frac{x \cdot t}{y}\\ \mathbf{else}:\\ \;\;\;\;t + z \cdot \frac{x}{y}\\ \end{array}\]
Alternative 7
Error13.6
Cost776
\[\begin{array}{l} \mathbf{if}\;t \leq -2.9559857728639686 \cdot 10^{-42} \lor \neg \left(t \leq 5.743968257821221 \cdot 10^{-96}\right):\\ \;\;\;\;t - \frac{x \cdot t}{y}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x \cdot z}{y}\\ \end{array}\]
Alternative 8
Error24.3
Cost448
\[t - \frac{x \cdot t}{y}\]
Alternative 9
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Split input into 3 regimes
  2. if x < -1.14335541343869316e53

    1. Initial program 4.5

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

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

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

      \[\leadsto x \cdot \color{blue}{\frac{z - t}{y}} + t\]
    6. Simplified2.5

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

    if -1.14335541343869316e53 < x < 2.86595316540892498e-142

    1. Initial program 1.2

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

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

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

    if 2.86595316540892498e-142 < x

    1. Initial program 2.4

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary64_144002.4

      \[\leadsto \frac{x}{\color{blue}{1 \cdot y}} \cdot \left(z - t\right) + t\]
    4. Applied add-sqr-sqrt_binary64_144222.6

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.1433554134386932 \cdot 10^{+53}:\\ \;\;\;\;t + x \cdot \frac{z - t}{y}\\ \mathbf{elif}\;x \leq 2.865953165408925 \cdot 10^{-142}:\\ \;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;t + \sqrt{x} \cdot \left(\left(z - t\right) \cdot \frac{\sqrt{x}}{y}\right)\\ \end{array}\]

Reproduce

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