Average Error: 2.0 → 0.5
Time: 26.5s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[\left(x \cdot \sqrt{e^{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{{z}^{2}}{{1}^{2}}, \frac{1}{2}, \mathsf{fma}\left(z, 1, b\right)\right), a, \left(\log z - t\right) \cdot y\right)}}\right) \cdot \sqrt{e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)}}\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\left(x \cdot \sqrt{e^{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{{z}^{2}}{{1}^{2}}, \frac{1}{2}, \mathsf{fma}\left(z, 1, b\right)\right), a, \left(\log z - t\right) \cdot y\right)}}\right) \cdot \sqrt{e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)}}
double f(double x, double y, double z, double t, double a, double b) {
        double r86596 = x;
        double r86597 = y;
        double r86598 = z;
        double r86599 = log(r86598);
        double r86600 = t;
        double r86601 = r86599 - r86600;
        double r86602 = r86597 * r86601;
        double r86603 = a;
        double r86604 = 1.0;
        double r86605 = r86604 - r86598;
        double r86606 = log(r86605);
        double r86607 = b;
        double r86608 = r86606 - r86607;
        double r86609 = r86603 * r86608;
        double r86610 = r86602 + r86609;
        double r86611 = exp(r86610);
        double r86612 = r86596 * r86611;
        return r86612;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r86613 = x;
        double r86614 = 1.0;
        double r86615 = log(r86614);
        double r86616 = z;
        double r86617 = 2.0;
        double r86618 = pow(r86616, r86617);
        double r86619 = pow(r86614, r86617);
        double r86620 = r86618 / r86619;
        double r86621 = 0.5;
        double r86622 = b;
        double r86623 = fma(r86616, r86614, r86622);
        double r86624 = fma(r86620, r86621, r86623);
        double r86625 = r86615 - r86624;
        double r86626 = a;
        double r86627 = log(r86616);
        double r86628 = t;
        double r86629 = r86627 - r86628;
        double r86630 = y;
        double r86631 = r86629 * r86630;
        double r86632 = fma(r86625, r86626, r86631);
        double r86633 = exp(r86632);
        double r86634 = sqrt(r86633);
        double r86635 = r86613 * r86634;
        double r86636 = r86630 * r86629;
        double r86637 = r86614 * r86616;
        double r86638 = fma(r86621, r86620, r86637);
        double r86639 = r86615 - r86638;
        double r86640 = r86639 - r86622;
        double r86641 = r86626 * r86640;
        double r86642 = r86636 + r86641;
        double r86643 = exp(r86642);
        double r86644 = sqrt(r86643);
        double r86645 = r86635 * r86644;
        return r86645;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 2.0

    \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
  2. Taylor expanded around 0 0.5

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(\log 1 - \left(\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z\right)\right)} - b\right)}\]
  3. Simplified0.5

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right)} - b\right)}\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt0.5

    \[\leadsto x \cdot \color{blue}{\left(\sqrt{e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)}} \cdot \sqrt{e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)}}\right)}\]
  6. Applied associate-*r*0.5

    \[\leadsto \color{blue}{\left(x \cdot \sqrt{e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)}}\right) \cdot \sqrt{e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)}}}\]
  7. Simplified0.5

    \[\leadsto \color{blue}{\left(x \cdot \sqrt{e^{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{{z}^{2}}{{1}^{2}}, \frac{1}{2}, \mathsf{fma}\left(z, 1, b\right)\right), a, \left(\log z - t\right) \cdot y\right)}}\right)} \cdot \sqrt{e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)}}\]
  8. Final simplification0.5

    \[\leadsto \left(x \cdot \sqrt{e^{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{{z}^{2}}{{1}^{2}}, \frac{1}{2}, \mathsf{fma}\left(z, 1, b\right)\right), a, \left(\log z - t\right) \cdot y\right)}}\right) \cdot \sqrt{e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)}}\]

Reproduce

herbie shell --seed 2019209 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1 z)) b))))))