Average Error: 14.6 → 3.4
Time: 3.9s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9.3878818852046316 \cdot 10^{-93}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{z}{\frac{y}{z + 1}}}\\ \mathbf{elif}\;x \le 4.2995607714224371 \cdot 10^{-167}:\\ \;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}\\ \end{array}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
\mathbf{if}\;x \le -9.3878818852046316 \cdot 10^{-93}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{z}{\frac{y}{z + 1}}}\\

\mathbf{elif}\;x \le 4.2995607714224371 \cdot 10^{-167}:\\
\;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}\\

\end{array}
double f(double x, double y, double z) {
        double r256448 = x;
        double r256449 = y;
        double r256450 = r256448 * r256449;
        double r256451 = z;
        double r256452 = r256451 * r256451;
        double r256453 = 1.0;
        double r256454 = r256451 + r256453;
        double r256455 = r256452 * r256454;
        double r256456 = r256450 / r256455;
        return r256456;
}

double f(double x, double y, double z) {
        double r256457 = x;
        double r256458 = -9.387881885204632e-93;
        bool r256459 = r256457 <= r256458;
        double r256460 = 1.0;
        double r256461 = z;
        double r256462 = r256460 / r256461;
        double r256463 = y;
        double r256464 = 1.0;
        double r256465 = r256461 + r256464;
        double r256466 = r256463 / r256465;
        double r256467 = r256461 / r256466;
        double r256468 = r256457 / r256467;
        double r256469 = r256462 * r256468;
        double r256470 = 4.299560771422437e-167;
        bool r256471 = r256457 <= r256470;
        double r256472 = r256457 / r256461;
        double r256473 = r256472 / r256461;
        double r256474 = r256473 * r256466;
        double r256475 = r256466 / r256461;
        double r256476 = r256472 * r256475;
        double r256477 = r256471 ? r256474 : r256476;
        double r256478 = r256459 ? r256469 : r256477;
        return r256478;
}

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.6
Target4.2
Herbie3.4
\[\begin{array}{l} \mathbf{if}\;z \lt 249.618281453230708:\\ \;\;\;\;\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 3 regimes
  2. if x < -9.387881885204632e-93

    1. Initial program 14.7

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

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

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

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

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

      \[\leadsto \frac{1}{z} \cdot \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z}}\]
    10. Using strategy rm
    11. Applied associate-/l*2.8

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

    if -9.387881885204632e-93 < x < 4.299560771422437e-167

    1. Initial program 14.0

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

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}}\]
    4. Using strategy rm
    5. Applied associate-/r*4.4

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

    if 4.299560771422437e-167 < x

    1. Initial program 15.1

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

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

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

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

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

      \[\leadsto \frac{1}{z} \cdot \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z}}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity3.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.3878818852046316 \cdot 10^{-93}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{z}{\frac{y}{z + 1}}}\\ \mathbf{elif}\;x \le 4.2995607714224371 \cdot 10^{-167}:\\ \;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020034 +o rules:numerics
(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))))