Average Error: 14.9 → 0.7
Time: 3.0s
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 r227871 = x;
        double r227872 = y;
        double r227873 = r227871 * r227872;
        double r227874 = z;
        double r227875 = r227874 * r227874;
        double r227876 = 1.0;
        double r227877 = r227874 + r227876;
        double r227878 = r227875 * r227877;
        double r227879 = r227873 / r227878;
        return r227879;
}

double f(double x, double y, double z) {
        double r227880 = x;
        double r227881 = y;
        double r227882 = r227880 * r227881;
        double r227883 = -1.2279572318155446e+117;
        bool r227884 = r227882 <= r227883;
        double r227885 = -1.0472950430294624e-267;
        bool r227886 = r227882 <= r227885;
        double r227887 = -0.0;
        bool r227888 = r227882 <= r227887;
        double r227889 = 3.3080526722476743e+269;
        bool r227890 = r227882 <= r227889;
        double r227891 = !r227890;
        bool r227892 = r227888 || r227891;
        double r227893 = !r227892;
        bool r227894 = r227886 || r227893;
        double r227895 = !r227894;
        bool r227896 = r227884 || r227895;
        double r227897 = z;
        double r227898 = r227880 / r227897;
        double r227899 = 1.0;
        double r227900 = r227897 + r227899;
        double r227901 = r227881 / r227897;
        double r227902 = r227900 / r227901;
        double r227903 = r227898 / r227902;
        double r227904 = r227882 / r227897;
        double r227905 = r227904 / r227897;
        double r227906 = r227905 / r227900;
        double r227907 = r227896 ? r227903 : r227906;
        return r227907;
}

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 
(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))))