Average Error: 14.2 → 2.7
Time: 12.8s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
\[\frac{1}{\frac{z}{\frac{y}{z} \cdot \frac{x}{z + 1.0}}}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}
\frac{1}{\frac{z}{\frac{y}{z} \cdot \frac{x}{z + 1.0}}}
double f(double x, double y, double z) {
        double r12652223 = x;
        double r12652224 = y;
        double r12652225 = r12652223 * r12652224;
        double r12652226 = z;
        double r12652227 = r12652226 * r12652226;
        double r12652228 = 1.0;
        double r12652229 = r12652226 + r12652228;
        double r12652230 = r12652227 * r12652229;
        double r12652231 = r12652225 / r12652230;
        return r12652231;
}

double f(double x, double y, double z) {
        double r12652232 = 1.0;
        double r12652233 = z;
        double r12652234 = y;
        double r12652235 = r12652234 / r12652233;
        double r12652236 = x;
        double r12652237 = 1.0;
        double r12652238 = r12652233 + r12652237;
        double r12652239 = r12652236 / r12652238;
        double r12652240 = r12652235 * r12652239;
        double r12652241 = r12652233 / r12652240;
        double r12652242 = r12652232 / r12652241;
        return r12652242;
}

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.2
Target3.9
Herbie2.7
\[\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.2

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

    \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1.0}}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity10.4

    \[\leadsto \frac{\color{blue}{1 \cdot x}}{z \cdot z} \cdot \frac{y}{z + 1.0}\]
  6. Applied times-frac5.5

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

    \[\leadsto \color{blue}{\frac{1}{z} \cdot \left(\frac{x}{z} \cdot \frac{y}{z + 1.0}\right)}\]
  8. Using strategy rm
  9. Applied associate-*l/5.5

    \[\leadsto \frac{1}{z} \cdot \color{blue}{\frac{x \cdot \frac{y}{z + 1.0}}{z}}\]
  10. Applied associate-*r/5.5

    \[\leadsto \color{blue}{\frac{\frac{1}{z} \cdot \left(x \cdot \frac{y}{z + 1.0}\right)}{z}}\]
  11. Simplified2.5

    \[\leadsto \frac{\color{blue}{\frac{y}{z} \cdot \frac{x}{z + 1.0}}}{z}\]
  12. Using strategy rm
  13. Applied clear-num2.7

    \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{y}{z} \cdot \frac{x}{z + 1.0}}}}\]
  14. Final simplification2.7

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

Reproduce

herbie shell --seed 2019164 +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))))