Average Error: 1.5 → 0.6
Time: 2.9s
Precision: binary64
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -9.12768191119368089 \cdot 10^{81} \lor \neg \left(x \le 5.78331589496851 \cdot 10^{-137}\right):\\ \;\;\;\;\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x}{y} \cdot z\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{x \cdot z}{y}\right|\\ \end{array}\]
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\begin{array}{l}
\mathbf{if}\;x \le -9.12768191119368089 \cdot 10^{81} \lor \neg \left(x \le 5.78331589496851 \cdot 10^{-137}\right):\\
\;\;\;\;\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x}{y} \cdot z\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - \frac{x \cdot z}{y}\right|\\

\end{array}
double code(double x, double y, double z) {
	return ((double) fabs(((double) (((double) (((double) (x + 4.0)) / y)) - ((double) (((double) (x / y)) * z))))));
}
double code(double x, double y, double z) {
	double VAR;
	if (((x <= -9.127681911193681e+81) || !(x <= 5.783315894968513e-137))) {
		VAR = ((double) fabs(((double) (((double) (((double) (4.0 * ((double) (1.0 / y)))) + ((double) (x / y)))) - ((double) (((double) (x / y)) * z))))));
	} else {
		VAR = ((double) fabs(((double) (((double) (((double) (x + 4.0)) / y)) - ((double) (((double) (x * z)) / y))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -9.12768191119368089e81 or 5.78331589496851e-137 < x

    1. Initial program 0.7

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Taylor expanded around 0 0.7

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

    if -9.12768191119368089e81 < x < 5.78331589496851e-137

    1. Initial program 2.2

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied associate-*l/0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.12768191119368089 \cdot 10^{81} \lor \neg \left(x \le 5.78331589496851 \cdot 10^{-137}\right):\\ \;\;\;\;\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x}{y} \cdot z\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{x \cdot z}{y}\right|\\ \end{array}\]

Reproduce

herbie shell --seed 2020162 
(FPCore (x y z)
  :name "fabs fraction 1"
  :precision binary64
  (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))