Average Error: 14.6 → 1.5
Time: 3.6s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.2195050503600045 \cdot 10^{225}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}\\ \mathbf{elif}\;x \cdot y \le -2.6832295035694302 \cdot 10^{-93}:\\ \;\;\;\;\frac{\frac{x \cdot y}{{z}^{2}}}{z + 1}\\ \mathbf{elif}\;x \cdot y \le 2.652005496261341 \cdot 10^{-197}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{x \cdot \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 \cdot y \le -1.2195050503600045 \cdot 10^{225}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}\\

\mathbf{elif}\;x \cdot y \le -2.6832295035694302 \cdot 10^{-93}:\\
\;\;\;\;\frac{\frac{x \cdot y}{{z}^{2}}}{z + 1}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r296446 = x;
        double r296447 = y;
        double r296448 = r296446 * r296447;
        double r296449 = z;
        double r296450 = r296449 * r296449;
        double r296451 = 1.0;
        double r296452 = r296449 + r296451;
        double r296453 = r296450 * r296452;
        double r296454 = r296448 / r296453;
        return r296454;
}

double f(double x, double y, double z) {
        double r296455 = x;
        double r296456 = y;
        double r296457 = r296455 * r296456;
        double r296458 = -1.2195050503600045e+225;
        bool r296459 = r296457 <= r296458;
        double r296460 = z;
        double r296461 = r296455 / r296460;
        double r296462 = 1.0;
        double r296463 = r296460 + r296462;
        double r296464 = r296456 / r296463;
        double r296465 = r296464 / r296460;
        double r296466 = r296461 * r296465;
        double r296467 = -2.6832295035694302e-93;
        bool r296468 = r296457 <= r296467;
        double r296469 = 2.0;
        double r296470 = pow(r296460, r296469);
        double r296471 = r296457 / r296470;
        double r296472 = r296471 / r296463;
        double r296473 = 2.652005496261341e-197;
        bool r296474 = r296457 <= r296473;
        double r296475 = 1.0;
        double r296476 = r296475 / r296460;
        double r296477 = r296455 * r296464;
        double r296478 = r296477 / r296460;
        double r296479 = r296476 * r296478;
        double r296480 = r296474 ? r296466 : r296479;
        double r296481 = r296468 ? r296472 : r296480;
        double r296482 = r296459 ? r296466 : r296481;
        return r296482;
}

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
Herbie1.5
\[\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 y) < -1.2195050503600045e+225 or -2.6832295035694302e-93 < (* x y) < 2.652005496261341e-197

    1. Initial program 20.5

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{z} \cdot \left(\frac{x}{z} \cdot \frac{y}{z + 1}\right)}\]
    8. Using strategy rm
    9. Applied div-inv2.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*2.6

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

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

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

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

    if -1.2195050503600045e+225 < (* x y) < -2.6832295035694302e-93

    1. Initial program 4.4

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

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

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

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

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

      \[\leadsto \frac{1}{z} \cdot \color{blue}{\frac{\frac{x}{z} \cdot y}{z + 1}}\]
    10. Applied associate-*r/2.5

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

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

    if 2.652005496261341e-197 < (* x y)

    1. Initial program 13.1

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

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

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

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

      \[\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/2.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.2195050503600045 \cdot 10^{225}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}\\ \mathbf{elif}\;x \cdot y \le -2.6832295035694302 \cdot 10^{-93}:\\ \;\;\;\;\frac{\frac{x \cdot y}{{z}^{2}}}{z + 1}\\ \mathbf{elif}\;x \cdot y \le 2.652005496261341 \cdot 10^{-197}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{x \cdot \frac{y}{z + 1}}{z}\\ \end{array}\]

Reproduce

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