Average Error: 23.0 → 19.8
Time: 6.9s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.5161511486463831 \cdot 10^{203} \lor \neg \left(z \le 4.74132684413093719 \cdot 10^{62}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y + z \cdot \left(t - a\right)\right) \cdot \frac{1}{y + z \cdot \left(b - y\right)}\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;z \le -3.5161511486463831 \cdot 10^{203} \lor \neg \left(z \le 4.74132684413093719 \cdot 10^{62}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

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

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return ((double) (((double) (((double) (x * y)) + ((double) (z * ((double) (t - a)))))) / ((double) (y + ((double) (z * ((double) (b - y))))))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double VAR;
	if (((z <= -3.516151148646383e+203) || !(z <= 4.741326844130937e+62))) {
		VAR = ((double) (((double) (t / b)) - ((double) (a / b))));
	} else {
		VAR = ((double) (((double) (((double) (x * y)) + ((double) (z * ((double) (t - a)))))) * ((double) (1.0 / ((double) (y + ((double) (z * ((double) (b - y))))))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original23.0
Target17.6
Herbie19.8
\[\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -3.516151148646383e+203 or 4.741326844130937e+62 < z

    1. Initial program 46.5

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}}\]
    5. Taylor expanded around inf 34.7

      \[\leadsto \color{blue}{\frac{t}{b} - \frac{a}{b}}\]

    if -3.516151148646383e+203 < z < 4.741326844130937e+62

    1. Initial program 13.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.5161511486463831 \cdot 10^{203} \lor \neg \left(z \le 4.74132684413093719 \cdot 10^{62}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y + z \cdot \left(t - a\right)\right) \cdot \frac{1}{y + z \cdot \left(b - y\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020113 +o rules:numerics
(FPCore (x y z t a b)
  :name "Development.Shake.Progress:decay from shake-0.15.5"
  :precision binary64

  :herbie-target
  (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z))))

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