Average Error: 14.5 → 1.9
Time: 18.8s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le 1.4340218294944 \cdot 10^{-310}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \left(\frac{y}{1.0 + z} \cdot \frac{1}{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{x}}{z} \cdot \frac{y}{1.0 + z}\right) \cdot \frac{\sqrt{x}}{z}\\ \end{array}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}
\begin{array}{l}
\mathbf{if}\;x \le 1.4340218294944 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{z} \cdot \left(x \cdot \left(\frac{y}{1.0 + z} \cdot \frac{1}{z}\right)\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r14002548 = x;
        double r14002549 = y;
        double r14002550 = r14002548 * r14002549;
        double r14002551 = z;
        double r14002552 = r14002551 * r14002551;
        double r14002553 = 1.0;
        double r14002554 = r14002551 + r14002553;
        double r14002555 = r14002552 * r14002554;
        double r14002556 = r14002550 / r14002555;
        return r14002556;
}

double f(double x, double y, double z) {
        double r14002557 = x;
        double r14002558 = 1.4340218294944e-310;
        bool r14002559 = r14002557 <= r14002558;
        double r14002560 = 1.0;
        double r14002561 = z;
        double r14002562 = r14002560 / r14002561;
        double r14002563 = y;
        double r14002564 = 1.0;
        double r14002565 = r14002564 + r14002561;
        double r14002566 = r14002563 / r14002565;
        double r14002567 = r14002566 * r14002562;
        double r14002568 = r14002557 * r14002567;
        double r14002569 = r14002562 * r14002568;
        double r14002570 = sqrt(r14002557);
        double r14002571 = r14002570 / r14002561;
        double r14002572 = r14002571 * r14002566;
        double r14002573 = r14002572 * r14002571;
        double r14002574 = r14002559 ? r14002569 : r14002573;
        return r14002574;
}

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
Target4.0
Herbie1.9
\[\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. Split input into 2 regimes
  2. if x < 1.4340218294944e-310

    1. Initial program 14.4

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

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

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

      \[\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 div-inv2.6

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

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

    if 1.4340218294944e-310 < x

    1. Initial program 14.6

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

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1.0}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt10.8

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

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

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

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

Reproduce

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