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

\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - \left(x \cdot z\right) \cdot \frac{1}{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 <= -1.3589800915338266e+122) || !(x <= 3.2817262128457574e-81))) {
		VAR = ((double) fabs(((double) (((double) (((double) (x + 4.0)) / y)) - ((double) (x * ((double) (z / y))))))));
	} else {
		VAR = ((double) fabs(((double) (((double) (((double) (x + 4.0)) / y)) - ((double) (((double) (x * z)) * ((double) (1.0 / 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 < -1.3589800915338266e+122 or 3.2817262128457574e-81 < x

    1. Initial program 0.3

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied div-inv0.4

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

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

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

    if -1.3589800915338266e+122 < x < 3.2817262128457574e-81

    1. Initial program 2.7

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
    2. Using strategy rm
    3. Applied div-inv2.7

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

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

      \[\leadsto \left|\frac{x + 4}{y} - x \cdot \color{blue}{\frac{z}{y}}\right|\]
    6. Using strategy rm
    7. Applied div-inv5.0

      \[\leadsto \left|\frac{x + 4}{y} - x \cdot \color{blue}{\left(z \cdot \frac{1}{y}\right)}\right|\]
    8. Applied associate-*r*0.8

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

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

Reproduce

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