Average Error: 14.5 → 3.0
Time: 16.4s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
\[\frac{\frac{y}{z + 1.0}}{z} \cdot \frac{x}{z}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}
\frac{\frac{y}{z + 1.0}}{z} \cdot \frac{x}{z}
double f(double x, double y, double z) {
        double r15617049 = x;
        double r15617050 = y;
        double r15617051 = r15617049 * r15617050;
        double r15617052 = z;
        double r15617053 = r15617052 * r15617052;
        double r15617054 = 1.0;
        double r15617055 = r15617052 + r15617054;
        double r15617056 = r15617053 * r15617055;
        double r15617057 = r15617051 / r15617056;
        return r15617057;
}

double f(double x, double y, double z) {
        double r15617058 = y;
        double r15617059 = z;
        double r15617060 = 1.0;
        double r15617061 = r15617059 + r15617060;
        double r15617062 = r15617058 / r15617061;
        double r15617063 = r15617062 / r15617059;
        double r15617064 = x;
        double r15617065 = r15617064 / r15617059;
        double r15617066 = r15617063 * r15617065;
        return r15617066;
}

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.5
Target3.9
Herbie3.0
\[\begin{array}{l} \mathbf{if}\;z \lt 249.6182814532307:\\ \;\;\;\;\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. Initial program 14.5

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
  2. Using strategy rm
  3. Applied times-frac11.0

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

    \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z}} \cdot \frac{y}{z + 1.0}\]
  6. Using strategy rm
  7. Applied div-inv5.9

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

    \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\frac{1}{z} \cdot \frac{y}{z + 1.0}\right)}\]
  9. Simplified3.0

    \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{\frac{y}{z + 1.0}}{z}}\]
  10. Final simplification3.0

    \[\leadsto \frac{\frac{y}{z + 1.0}}{z} \cdot \frac{x}{z}\]

Reproduce

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

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

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