Average Error: 15.1 → 2.2
Time: 12.1s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.613373892074471579208304034990856319902 \cdot 10^{212}:\\ \;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\ \mathbf{elif}\;x \le 1.07844560118457820066449789092983137547 \cdot 10^{67}:\\ \;\;\;\;\frac{\frac{\frac{x}{z} \cdot y}{z}}{z + 1}\\ \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 -3.613373892074471579208304034990856319902 \cdot 10^{212}:\\
\;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\

\mathbf{elif}\;x \le 1.07844560118457820066449789092983137547 \cdot 10^{67}:\\
\;\;\;\;\frac{\frac{\frac{x}{z} \cdot y}{z}}{z + 1}\\

\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 r382640 = x;
        double r382641 = y;
        double r382642 = r382640 * r382641;
        double r382643 = z;
        double r382644 = r382643 * r382643;
        double r382645 = 1.0;
        double r382646 = r382643 + r382645;
        double r382647 = r382644 * r382646;
        double r382648 = r382642 / r382647;
        return r382648;
}

double f(double x, double y, double z) {
        double r382649 = x;
        double r382650 = -3.6133738920744716e+212;
        bool r382651 = r382649 <= r382650;
        double r382652 = z;
        double r382653 = r382649 / r382652;
        double r382654 = r382653 / r382652;
        double r382655 = y;
        double r382656 = 1.0;
        double r382657 = r382652 + r382656;
        double r382658 = r382655 / r382657;
        double r382659 = r382654 * r382658;
        double r382660 = 1.0784456011845782e+67;
        bool r382661 = r382649 <= r382660;
        double r382662 = r382653 * r382655;
        double r382663 = r382662 / r382652;
        double r382664 = r382663 / r382657;
        double r382665 = sqrt(r382649);
        double r382666 = r382665 / r382652;
        double r382667 = r382666 * r382658;
        double r382668 = r382666 * r382667;
        double r382669 = r382661 ? r382664 : r382668;
        double r382670 = r382651 ? r382659 : r382669;
        return r382670;
}

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

Original15.1
Target4.4
Herbie2.2
\[\begin{array}{l} \mathbf{if}\;z \lt 249.6182814532307077115547144785523414612:\\ \;\;\;\;\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 < -3.6133738920744716e+212

    1. Initial program 29.4

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

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

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

    if -3.6133738920744716e+212 < x < 1.0784456011845782e+67

    1. Initial program 13.2

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{z} \cdot \frac{x}{z}\right)} \cdot \frac{y}{z + 1}\]
    7. Applied associate-*l*1.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-*r/1.9

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

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

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

    if 1.0784456011845782e+67 < x

    1. Initial program 19.5

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

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

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

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

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

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

Reproduce

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