Average Error: 1.9 → 0.2
Time: 33.2s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}\]
\[x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(e^{\mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{2} \cdot z, z \cdot 1.0, \log 1.0 - z \cdot 1.0\right) - b, y \cdot \left(\log z - t\right)\right)}\right)\right)\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}
x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(e^{\mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{2} \cdot z, z \cdot 1.0, \log 1.0 - z \cdot 1.0\right) - b, y \cdot \left(\log z - t\right)\right)}\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r6231690 = x;
        double r6231691 = y;
        double r6231692 = z;
        double r6231693 = log(r6231692);
        double r6231694 = t;
        double r6231695 = r6231693 - r6231694;
        double r6231696 = r6231691 * r6231695;
        double r6231697 = a;
        double r6231698 = 1.0;
        double r6231699 = r6231698 - r6231692;
        double r6231700 = log(r6231699);
        double r6231701 = b;
        double r6231702 = r6231700 - r6231701;
        double r6231703 = r6231697 * r6231702;
        double r6231704 = r6231696 + r6231703;
        double r6231705 = exp(r6231704);
        double r6231706 = r6231690 * r6231705;
        return r6231706;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6231707 = x;
        double r6231708 = a;
        double r6231709 = -0.5;
        double r6231710 = z;
        double r6231711 = r6231709 * r6231710;
        double r6231712 = 1.0;
        double r6231713 = r6231710 * r6231712;
        double r6231714 = log(r6231712);
        double r6231715 = r6231714 - r6231713;
        double r6231716 = fma(r6231711, r6231713, r6231715);
        double r6231717 = b;
        double r6231718 = r6231716 - r6231717;
        double r6231719 = y;
        double r6231720 = log(r6231710);
        double r6231721 = t;
        double r6231722 = r6231720 - r6231721;
        double r6231723 = r6231719 * r6231722;
        double r6231724 = fma(r6231708, r6231718, r6231723);
        double r6231725 = exp(r6231724);
        double r6231726 = log1p(r6231725);
        double r6231727 = expm1(r6231726);
        double r6231728 = r6231707 * r6231727;
        return r6231728;
}

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 1.9

    \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}\]
  2. Simplified1.7

    \[\leadsto \color{blue}{x \cdot e^{\mathsf{fma}\left(y, \log z - t, \left(\log \left(1.0 - z\right) - b\right) \cdot a\right)}}\]
  3. Taylor expanded around 0 0.2

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

    \[\leadsto x \cdot e^{\mathsf{fma}\left(y, \log z - t, \left(\color{blue}{\mathsf{fma}\left(\frac{z}{1.0} \cdot \frac{z}{1.0}, \frac{-1}{2}, \log 1.0 - 1.0 \cdot z\right)} - b\right) \cdot a\right)}\]
  5. Taylor expanded around inf 0.2

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

    \[\leadsto x \cdot \color{blue}{e^{\mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{2} \cdot z, 1.0 \cdot z, \log 1.0 - 1.0 \cdot z\right) - b, \left(\log z - t\right) \cdot y\right)}}\]
  7. Using strategy rm
  8. Applied expm1-log1p-u0.2

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

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

Reproduce

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