Average Error: 14.5 → 1.9
Time: 15.3s
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 r18340545 = x;
        double r18340546 = y;
        double r18340547 = r18340545 * r18340546;
        double r18340548 = z;
        double r18340549 = r18340548 * r18340548;
        double r18340550 = 1.0;
        double r18340551 = r18340548 + r18340550;
        double r18340552 = r18340549 * r18340551;
        double r18340553 = r18340547 / r18340552;
        return r18340553;
}

double f(double x, double y, double z) {
        double r18340554 = x;
        double r18340555 = 1.4340218294944e-310;
        bool r18340556 = r18340554 <= r18340555;
        double r18340557 = 1.0;
        double r18340558 = z;
        double r18340559 = r18340557 / r18340558;
        double r18340560 = y;
        double r18340561 = 1.0;
        double r18340562 = r18340561 + r18340558;
        double r18340563 = r18340560 / r18340562;
        double r18340564 = r18340563 * r18340559;
        double r18340565 = r18340554 * r18340564;
        double r18340566 = r18340559 * r18340565;
        double r18340567 = sqrt(r18340554);
        double r18340568 = r18340567 / r18340558;
        double r18340569 = r18340568 * r18340563;
        double r18340570 = r18340569 * r18340568;
        double r18340571 = r18340556 ? r18340566 : r18340570;
        return r18340571;
}

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