Average Error: 14.4 → 1.5
Time: 16.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.016276576594585246068174001205195423088 \cdot 10^{233} \lor \neg \left(x \cdot y \le -3.611308350661776465979355358690518285613 \cdot 10^{-309} \lor \neg \left(x \cdot y \le 3.455058524409785823529246333304241727902 \cdot 10^{-284}\right) \land x \cdot y \le 2.372675753595188659373323101137554870534 \cdot 10^{203}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot y}{z}}{z \cdot \left(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 \cdot y \le -1.016276576594585246068174001205195423088 \cdot 10^{233} \lor \neg \left(x \cdot y \le -3.611308350661776465979355358690518285613 \cdot 10^{-309} \lor \neg \left(x \cdot y \le 3.455058524409785823529246333304241727902 \cdot 10^{-284}\right) \land x \cdot y \le 2.372675753595188659373323101137554870534 \cdot 10^{203}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\

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

\end{array}
double f(double x, double y, double z) {
        double r231645 = x;
        double r231646 = y;
        double r231647 = r231645 * r231646;
        double r231648 = z;
        double r231649 = r231648 * r231648;
        double r231650 = 1.0;
        double r231651 = r231648 + r231650;
        double r231652 = r231649 * r231651;
        double r231653 = r231647 / r231652;
        return r231653;
}

double f(double x, double y, double z) {
        double r231654 = x;
        double r231655 = y;
        double r231656 = r231654 * r231655;
        double r231657 = -1.0162765765945852e+233;
        bool r231658 = r231656 <= r231657;
        double r231659 = -3.611308350661776e-309;
        bool r231660 = r231656 <= r231659;
        double r231661 = 3.455058524409786e-284;
        bool r231662 = r231656 <= r231661;
        double r231663 = !r231662;
        double r231664 = 2.3726757535951887e+203;
        bool r231665 = r231656 <= r231664;
        bool r231666 = r231663 && r231665;
        bool r231667 = r231660 || r231666;
        double r231668 = !r231667;
        bool r231669 = r231658 || r231668;
        double r231670 = z;
        double r231671 = r231654 / r231670;
        double r231672 = r231671 / r231670;
        double r231673 = 1.0;
        double r231674 = r231670 + r231673;
        double r231675 = r231655 / r231674;
        double r231676 = r231672 * r231675;
        double r231677 = r231656 / r231670;
        double r231678 = r231670 * r231674;
        double r231679 = r231677 / r231678;
        double r231680 = r231669 ? r231676 : r231679;
        return r231680;
}

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
Herbie1.5
\[\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 y) < -1.0162765765945852e+233 or -3.611308350661776e-309 < (* x y) < 3.455058524409786e-284 or 2.3726757535951887e+203 < (* x y)

    1. Initial program 32.5

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{z} \cdot \left(\frac{x}{z} \cdot \frac{y}{z + 1}\right)}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity3.3

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

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

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

    if -1.0162765765945852e+233 < (* x y) < -3.611308350661776e-309 or 3.455058524409786e-284 < (* x y) < 2.3726757535951887e+203

    1. Initial program 6.3

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

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

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

      \[\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 associate-*r/2.0

      \[\leadsto \frac{1}{z} \cdot \color{blue}{\frac{\frac{x}{z} \cdot y}{z + 1}}\]
    10. Applied frac-times2.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.016276576594585246068174001205195423088 \cdot 10^{233} \lor \neg \left(x \cdot y \le -3.611308350661776465979355358690518285613 \cdot 10^{-309} \lor \neg \left(x \cdot y \le 3.455058524409785823529246333304241727902 \cdot 10^{-284}\right) \land x \cdot y \le 2.372675753595188659373323101137554870534 \cdot 10^{203}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot y}{z}}{z \cdot \left(z + 1\right)}\\ \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.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1 z)) x) z))

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