Average Error: 14.4 → 2.6
Time: 4.5s
Precision: 64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.76669825863445846472626676068440040432 \cdot 10^{-200} \lor \neg \left(x \le 4.011879138669377443461781166767319250167 \cdot 10^{-178}\right):\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \frac{\frac{y}{z + 1}}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\ \end{array}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
\mathbf{if}\;x \le -4.76669825863445846472626676068440040432 \cdot 10^{-200} \lor \neg \left(x \le 4.011879138669377443461781166767319250167 \cdot 10^{-178}\right):\\
\;\;\;\;\frac{1}{z} \cdot \left(x \cdot \frac{\frac{y}{z + 1}}{z}\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r339158 = x;
        double r339159 = y;
        double r339160 = r339158 * r339159;
        double r339161 = z;
        double r339162 = r339161 * r339161;
        double r339163 = 1.0;
        double r339164 = r339161 + r339163;
        double r339165 = r339162 * r339164;
        double r339166 = r339160 / r339165;
        return r339166;
}

double f(double x, double y, double z) {
        double r339167 = x;
        double r339168 = -4.7666982586344585e-200;
        bool r339169 = r339167 <= r339168;
        double r339170 = 4.0118791386693774e-178;
        bool r339171 = r339167 <= r339170;
        double r339172 = !r339171;
        bool r339173 = r339169 || r339172;
        double r339174 = 1.0;
        double r339175 = z;
        double r339176 = r339174 / r339175;
        double r339177 = y;
        double r339178 = 1.0;
        double r339179 = r339175 + r339178;
        double r339180 = r339177 / r339179;
        double r339181 = r339180 / r339175;
        double r339182 = r339167 * r339181;
        double r339183 = r339176 * r339182;
        double r339184 = r339167 / r339175;
        double r339185 = r339184 / r339175;
        double r339186 = r339185 * r339180;
        double r339187 = r339173 ? r339183 : r339186;
        return r339187;
}

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.2
Herbie2.6
\[\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 2 regimes
  2. if x < -4.7666982586344585e-200 or 4.0118791386693774e-178 < x

    1. Initial program 14.4

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

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

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

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

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

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

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

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

    if -4.7666982586344585e-200 < x < 4.0118791386693774e-178

    1. Initial program 14.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.76669825863445846472626676068440040432 \cdot 10^{-200} \lor \neg \left(x \le 4.011879138669377443461781166767319250167 \cdot 10^{-178}\right):\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot \frac{\frac{y}{z + 1}}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2019322 
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z 249.618281453230708) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1 z)) x) z))

  (/ (* x y) (* (* z z) (+ z 1))))