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

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

\end{array}
double f(double x, double y, double z) {
        double r420328 = x;
        double r420329 = y;
        double r420330 = r420328 * r420329;
        double r420331 = z;
        double r420332 = r420331 * r420331;
        double r420333 = 1.0;
        double r420334 = r420331 + r420333;
        double r420335 = r420332 * r420334;
        double r420336 = r420330 / r420335;
        return r420336;
}

double f(double x, double y, double z) {
        double r420337 = x;
        double r420338 = 1.2783024294185706e-282;
        bool r420339 = r420337 <= r420338;
        double r420340 = 1.0;
        double r420341 = z;
        double r420342 = r420340 / r420341;
        double r420343 = y;
        double r420344 = 1.0;
        double r420345 = r420341 + r420344;
        double r420346 = r420343 / r420345;
        double r420347 = r420346 / r420341;
        double r420348 = r420337 * r420347;
        double r420349 = r420342 * r420348;
        double r420350 = sqrt(r420337);
        double r420351 = r420350 / r420341;
        double r420352 = r420351 * r420346;
        double r420353 = r420351 * r420352;
        double r420354 = r420339 ? r420349 : r420353;
        return r420354;
}

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.4
Target4.1
Herbie1.9
\[\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 2 regimes
  2. if x < 1.2783024294185706e-282

    1. Initial program 14.1

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

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

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

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

      \[\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*3.1

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

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

    if 1.2783024294185706e-282 < x

    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-frac10.9

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

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

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

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

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

Reproduce

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