Average Error: 15.1 → 3.2
Time: 11.1s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le 1.397762492297466341499239589884188911458 \cdot 10^{-65}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \frac{\frac{y}{z + 1}}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1} \cdot \left(\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\right)\\ \end{array}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
\mathbf{if}\;z \le 1.397762492297466341499239589884188911458 \cdot 10^{-65}:\\
\;\;\;\;\frac{1}{z} \cdot \left(x \cdot \frac{\frac{y}{z + 1}}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{1} \cdot \left(\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\right)\\

\end{array}
double f(double x, double y, double z) {
        double r344712 = x;
        double r344713 = y;
        double r344714 = r344712 * r344713;
        double r344715 = z;
        double r344716 = r344715 * r344715;
        double r344717 = 1.0;
        double r344718 = r344715 + r344717;
        double r344719 = r344716 * r344718;
        double r344720 = r344714 / r344719;
        return r344720;
}

double f(double x, double y, double z) {
        double r344721 = z;
        double r344722 = 1.3977624922974663e-65;
        bool r344723 = r344721 <= r344722;
        double r344724 = 1.0;
        double r344725 = r344724 / r344721;
        double r344726 = x;
        double r344727 = y;
        double r344728 = 1.0;
        double r344729 = r344721 + r344728;
        double r344730 = r344727 / r344729;
        double r344731 = r344730 / r344721;
        double r344732 = r344726 * r344731;
        double r344733 = r344725 * r344732;
        double r344734 = sqrt(r344724);
        double r344735 = r344726 / r344721;
        double r344736 = r344735 / r344721;
        double r344737 = r344736 * r344730;
        double r344738 = r344734 * r344737;
        double r344739 = r344723 ? r344733 : r344738;
        return r344739;
}

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

Original15.1
Target4.4
Herbie3.2
\[\begin{array}{l} \mathbf{if}\;z \lt 249.6182814532307077115547144785523414612:\\ \;\;\;\;\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 z < 1.3977624922974663e-65

    1. Initial program 18.2

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{z} \cdot \left(\frac{x}{z} \cdot \frac{y}{z + 1}\right)}\]
    8. Using strategy rm
    9. Applied div-inv3.4

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

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

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

    if 1.3977624922974663e-65 < z

    1. Initial program 10.2

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{z} \cdot \left(\frac{x}{z} \cdot \frac{y}{z + 1}\right)}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity1.8

      \[\leadsto \frac{1}{\color{blue}{1 \cdot z}} \cdot \left(\frac{x}{z} \cdot \frac{y}{z + 1}\right)\]
    10. Applied add-sqr-sqrt1.8

      \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{1 \cdot z} \cdot \left(\frac{x}{z} \cdot \frac{y}{z + 1}\right)\]
    11. Applied times-frac1.8

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

      \[\leadsto \color{blue}{\frac{\sqrt{1}}{1} \cdot \left(\frac{\sqrt{1}}{z} \cdot \left(\frac{x}{z} \cdot \frac{y}{z + 1}\right)\right)}\]
    13. Simplified2.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 1.397762492297466341499239589884188911458 \cdot 10^{-65}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \frac{\frac{y}{z + 1}}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1} \cdot \left(\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019350 
(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))))