Average Error: 1.7 → 0.2
Time: 3.9s
Precision: 64
\[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.141065750945845758760211222436365665667 \cdot 10^{-15} \lor \neg \left(x \le 4.40041470183000606091280929473849033149 \cdot 10^{-62}\right):\\ \;\;\;\;\left|\frac{x + 4}{y} - {\left(x \cdot \frac{z}{y}\right)}^{1}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(x + 4\right) - 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 -3.141065750945845758760211222436365665667 \cdot 10^{-15} \lor \neg \left(x \le 4.40041470183000606091280929473849033149 \cdot 10^{-62}\right):\\
\;\;\;\;\left|\frac{x + 4}{y} - {\left(x \cdot \frac{z}{y}\right)}^{1}\right|\\

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

\end{array}
double f(double x, double y, double z) {
        double r32958 = x;
        double r32959 = 4.0;
        double r32960 = r32958 + r32959;
        double r32961 = y;
        double r32962 = r32960 / r32961;
        double r32963 = r32958 / r32961;
        double r32964 = z;
        double r32965 = r32963 * r32964;
        double r32966 = r32962 - r32965;
        double r32967 = fabs(r32966);
        return r32967;
}

double f(double x, double y, double z) {
        double r32968 = x;
        double r32969 = -3.1410657509458458e-15;
        bool r32970 = r32968 <= r32969;
        double r32971 = 4.400414701830006e-62;
        bool r32972 = r32968 <= r32971;
        double r32973 = !r32972;
        bool r32974 = r32970 || r32973;
        double r32975 = 4.0;
        double r32976 = r32968 + r32975;
        double r32977 = y;
        double r32978 = r32976 / r32977;
        double r32979 = z;
        double r32980 = r32979 / r32977;
        double r32981 = r32968 * r32980;
        double r32982 = 1.0;
        double r32983 = pow(r32981, r32982);
        double r32984 = r32978 - r32983;
        double r32985 = fabs(r32984);
        double r32986 = r32968 * r32979;
        double r32987 = r32976 - r32986;
        double r32988 = r32987 / r32977;
        double r32989 = fabs(r32988);
        double r32990 = r32974 ? r32985 : r32989;
        return r32990;
}

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 < -3.1410657509458458e-15 or 4.400414701830006e-62 < x

    1. Initial program 0.2

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

      \[\leadsto \left|\frac{x + 4}{y} - \frac{x}{\color{blue}{1 \cdot y}} \cdot z\right|\]
    4. Applied add-cube-cbrt0.6

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

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1} \cdot \left(\frac{\sqrt[3]{x}}{y} \cdot z\right)}\right|\]
    7. Using strategy rm
    8. Applied pow10.7

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

      \[\leadsto \left|\frac{x + 4}{y} - \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1} \cdot \left(\color{blue}{{\left(\frac{\sqrt[3]{x}}{y}\right)}^{1}} \cdot {z}^{1}\right)\right|\]
    10. Applied pow-prod-down0.7

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1}\right)}^{1}} \cdot {\left(\frac{\sqrt[3]{x}}{y} \cdot z\right)}^{1}\right|\]
    12. Applied pow-prod-down0.7

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

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

    if -3.1410657509458458e-15 < x < 4.400414701830006e-62

    1. Initial program 2.9

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

      \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x \cdot z}{y}}\right|\]
    4. Applied sub-div0.1

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

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

Reproduce

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