Average Error: 1.7 → 0.7
Time: 5.2s
Precision: binary64
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.045130865518068 \cdot 10^{-32} \lor \neg \left(y \le 2.53733113516034195 \cdot 10^{221}\right):\\ \;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\frac{x}{\sqrt[3]{y}} \cdot z\right)\right|\\ \end{array}\]
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\begin{array}{l}
\mathbf{if}\;y \le -4.045130865518068 \cdot 10^{-32} \lor \neg \left(y \le 2.53733113516034195 \cdot 10^{221}\right):\\
\;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - \frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\frac{x}{\sqrt[3]{y}} \cdot z\right)\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 (((y <= -4.045130865518068e-32) || !(y <= 2.537331135160342e+221))) {
		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) (1.0 / ((double) (((double) cbrt(y)) * ((double) cbrt(y)))))) * ((double) (((double) (x / ((double) cbrt(y)))) * z))))))));
	}
	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 y < -4.045130865518068e-32 or 2.53733113516034195e221 < y

    1. Initial program 3.4

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

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

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

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

    if -4.045130865518068e-32 < y < 2.53733113516034195e221

    1. Initial program 0.4

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

      \[\leadsto \left|\frac{x + 4}{y} - \frac{x}{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}} \cdot z\right|\]
    4. Applied *-un-lft-identity0.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.045130865518068 \cdot 10^{-32} \lor \neg \left(y \le 2.53733113516034195 \cdot 10^{221}\right):\\ \;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + 4}{y} - \frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\frac{x}{\sqrt[3]{y}} \cdot z\right)\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))))