Average Error: 14.9 → 0.7
Time: 3.1s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.2279572318155446 \cdot 10^{117} \lor \neg \left(x \cdot y \le -1.047295043029462 \cdot 10^{-267} \lor \neg \left(x \cdot y \le -0.0 \lor \neg \left(x \cdot y \le 3.3080526722476743 \cdot 10^{269}\right)\right)\right):\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x \cdot y}{z}}{z}}{z + 1}\\ \end{array}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.2279572318155446 \cdot 10^{117} \lor \neg \left(x \cdot y \le -1.047295043029462 \cdot 10^{-267} \lor \neg \left(x \cdot y \le -0.0 \lor \neg \left(x \cdot y \le 3.3080526722476743 \cdot 10^{269}\right)\right)\right):\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{x \cdot y}{z}}{z}}{z + 1}\\

\end{array}
double f(double x, double y, double z) {
        double r260884 = x;
        double r260885 = y;
        double r260886 = r260884 * r260885;
        double r260887 = z;
        double r260888 = r260887 * r260887;
        double r260889 = 1.0;
        double r260890 = r260887 + r260889;
        double r260891 = r260888 * r260890;
        double r260892 = r260886 / r260891;
        return r260892;
}

double f(double x, double y, double z) {
        double r260893 = x;
        double r260894 = y;
        double r260895 = r260893 * r260894;
        double r260896 = -1.2279572318155446e+117;
        bool r260897 = r260895 <= r260896;
        double r260898 = -1.0472950430294624e-267;
        bool r260899 = r260895 <= r260898;
        double r260900 = -0.0;
        bool r260901 = r260895 <= r260900;
        double r260902 = 3.3080526722476743e+269;
        bool r260903 = r260895 <= r260902;
        double r260904 = !r260903;
        bool r260905 = r260901 || r260904;
        double r260906 = !r260905;
        bool r260907 = r260899 || r260906;
        double r260908 = !r260907;
        bool r260909 = r260897 || r260908;
        double r260910 = z;
        double r260911 = r260893 / r260910;
        double r260912 = 1.0;
        double r260913 = r260910 + r260912;
        double r260914 = r260894 / r260910;
        double r260915 = r260913 / r260914;
        double r260916 = r260911 / r260915;
        double r260917 = r260895 / r260910;
        double r260918 = r260917 / r260910;
        double r260919 = r260918 / r260913;
        double r260920 = r260909 ? r260916 : r260919;
        return r260920;
}

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

Target

Original14.9
Target3.6
Herbie0.7
\[\begin{array}{l} \mathbf{if}\;z \lt 249.618281453230708:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* x y) < -1.2279572318155446e+117 or -1.0472950430294624e-267 < (* x y) < -0.0 or 3.3080526722476743e+269 < (* x y)

    1. Initial program 30.1

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*27.8

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot z}}{z + 1}}\]
    4. Using strategy rm
    5. Applied times-frac1.4

      \[\leadsto \frac{\color{blue}{\frac{x}{z} \cdot \frac{y}{z}}}{z + 1}\]
    6. Applied associate-/l*1.3

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}}\]

    if -1.2279572318155446e+117 < (* x y) < -1.0472950430294624e-267 or -0.0 < (* x y) < 3.3080526722476743e+269

    1. Initial program 7.1

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*5.8

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot z}}{z + 1}}\]
    4. Using strategy rm
    5. Applied associate-/r*0.4

      \[\leadsto \frac{\color{blue}{\frac{\frac{x \cdot y}{z}}{z}}}{z + 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.2279572318155446 \cdot 10^{117} \lor \neg \left(x \cdot y \le -1.047295043029462 \cdot 10^{-267} \lor \neg \left(x \cdot y \le -0.0 \lor \neg \left(x \cdot y \le 3.3080526722476743 \cdot 10^{269}\right)\right)\right):\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x \cdot y}{z}}{z}}{z + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020035 +o rules:numerics
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1 z)) x) z))

  (/ (* x y) (* (* z z) (+ z 1))))