Average Error: 13.9 → 1.8
Time: 16.3s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -7.4960041203550645 \cdot 10^{+289}:\\ \;\;\;\;\left(\frac{y}{z + 1.0} \cdot \frac{1}{z}\right) \cdot \left(\frac{1}{z} \cdot x\right)\\ \mathbf{elif}\;x \cdot y \le -4.94154134334905 \cdot 10^{-156}:\\ \;\;\;\;\frac{\frac{x \cdot y}{z \cdot z}}{z + 1.0}\\ \mathbf{elif}\;x \cdot y \le 1.0218548433569062 \cdot 10^{-145}:\\ \;\;\;\;\left(\frac{y}{z + 1.0} \cdot \frac{1}{z}\right) \cdot \left(\frac{1}{z} \cdot x\right)\\ \mathbf{elif}\;x \cdot y \le 8.072639718356034 \cdot 10^{+159}:\\ \;\;\;\;\frac{\frac{x \cdot y}{z \cdot z}}{z + 1.0}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{z + 1.0} \cdot \frac{1}{z}\right) \cdot \left(\frac{1}{z} \cdot x\right)\\ \end{array}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -7.4960041203550645 \cdot 10^{+289}:\\
\;\;\;\;\left(\frac{y}{z + 1.0} \cdot \frac{1}{z}\right) \cdot \left(\frac{1}{z} \cdot x\right)\\

\mathbf{elif}\;x \cdot y \le -4.94154134334905 \cdot 10^{-156}:\\
\;\;\;\;\frac{\frac{x \cdot y}{z \cdot z}}{z + 1.0}\\

\mathbf{elif}\;x \cdot y \le 1.0218548433569062 \cdot 10^{-145}:\\
\;\;\;\;\left(\frac{y}{z + 1.0} \cdot \frac{1}{z}\right) \cdot \left(\frac{1}{z} \cdot x\right)\\

\mathbf{elif}\;x \cdot y \le 8.072639718356034 \cdot 10^{+159}:\\
\;\;\;\;\frac{\frac{x \cdot y}{z \cdot z}}{z + 1.0}\\

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

\end{array}
double f(double x, double y, double z) {
        double r6289687 = x;
        double r6289688 = y;
        double r6289689 = r6289687 * r6289688;
        double r6289690 = z;
        double r6289691 = r6289690 * r6289690;
        double r6289692 = 1.0;
        double r6289693 = r6289690 + r6289692;
        double r6289694 = r6289691 * r6289693;
        double r6289695 = r6289689 / r6289694;
        return r6289695;
}

double f(double x, double y, double z) {
        double r6289696 = x;
        double r6289697 = y;
        double r6289698 = r6289696 * r6289697;
        double r6289699 = -7.4960041203550645e+289;
        bool r6289700 = r6289698 <= r6289699;
        double r6289701 = z;
        double r6289702 = 1.0;
        double r6289703 = r6289701 + r6289702;
        double r6289704 = r6289697 / r6289703;
        double r6289705 = 1.0;
        double r6289706 = r6289705 / r6289701;
        double r6289707 = r6289704 * r6289706;
        double r6289708 = r6289706 * r6289696;
        double r6289709 = r6289707 * r6289708;
        double r6289710 = -4.94154134334905e-156;
        bool r6289711 = r6289698 <= r6289710;
        double r6289712 = r6289701 * r6289701;
        double r6289713 = r6289698 / r6289712;
        double r6289714 = r6289713 / r6289703;
        double r6289715 = 1.0218548433569062e-145;
        bool r6289716 = r6289698 <= r6289715;
        double r6289717 = 8.072639718356034e+159;
        bool r6289718 = r6289698 <= r6289717;
        double r6289719 = r6289718 ? r6289714 : r6289709;
        double r6289720 = r6289716 ? r6289709 : r6289719;
        double r6289721 = r6289711 ? r6289714 : r6289720;
        double r6289722 = r6289700 ? r6289709 : r6289721;
        return r6289722;
}

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

Original13.9
Target3.9
Herbie1.8
\[\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 y) < -7.4960041203550645e+289 or -4.94154134334905e-156 < (* x y) < 1.0218548433569062e-145 or 8.072639718356034e+159 < (* x y)

    1. Initial program 22.5

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

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

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

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

      \[\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.0

      \[\leadsto \frac{1}{z} \cdot \color{blue}{\left(x \cdot \left(\frac{1}{z} \cdot \frac{y}{z + 1.0}\right)\right)}\]
    11. Using strategy rm
    12. Applied associate-*r*1.2

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

    if -7.4960041203550645e+289 < (* x y) < -4.94154134334905e-156 or 1.0218548433569062e-145 < (* x y) < 8.072639718356034e+159

    1. Initial program 5.0

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*2.5

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot z}}{z + 1.0}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -7.4960041203550645 \cdot 10^{+289}:\\ \;\;\;\;\left(\frac{y}{z + 1.0} \cdot \frac{1}{z}\right) \cdot \left(\frac{1}{z} \cdot x\right)\\ \mathbf{elif}\;x \cdot y \le -4.94154134334905 \cdot 10^{-156}:\\ \;\;\;\;\frac{\frac{x \cdot y}{z \cdot z}}{z + 1.0}\\ \mathbf{elif}\;x \cdot y \le 1.0218548433569062 \cdot 10^{-145}:\\ \;\;\;\;\left(\frac{y}{z + 1.0} \cdot \frac{1}{z}\right) \cdot \left(\frac{1}{z} \cdot x\right)\\ \mathbf{elif}\;x \cdot y \le 8.072639718356034 \cdot 10^{+159}:\\ \;\;\;\;\frac{\frac{x \cdot y}{z \cdot z}}{z + 1.0}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{z + 1.0} \cdot \frac{1}{z}\right) \cdot \left(\frac{1}{z} \cdot x\right)\\ \end{array}\]

Reproduce

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