Average Error: 1.7 → 0.3
Time: 30.8s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left({e}^{\left(\mathsf{fma}\left(\log z - t, y, a \cdot \left(\mathsf{fma}\left(\frac{z}{1.0} \cdot \frac{z}{1.0}, \frac{-1}{2}, \log 1.0\right) - \mathsf{fma}\left(z, 1.0, b\right)\right)\right)\right)}\right)\right) \cdot x\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}
\mathsf{expm1}\left(\mathsf{log1p}\left({e}^{\left(\mathsf{fma}\left(\log z - t, y, a \cdot \left(\mathsf{fma}\left(\frac{z}{1.0} \cdot \frac{z}{1.0}, \frac{-1}{2}, \log 1.0\right) - \mathsf{fma}\left(z, 1.0, b\right)\right)\right)\right)}\right)\right) \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r5344726 = x;
        double r5344727 = y;
        double r5344728 = z;
        double r5344729 = log(r5344728);
        double r5344730 = t;
        double r5344731 = r5344729 - r5344730;
        double r5344732 = r5344727 * r5344731;
        double r5344733 = a;
        double r5344734 = 1.0;
        double r5344735 = r5344734 - r5344728;
        double r5344736 = log(r5344735);
        double r5344737 = b;
        double r5344738 = r5344736 - r5344737;
        double r5344739 = r5344733 * r5344738;
        double r5344740 = r5344732 + r5344739;
        double r5344741 = exp(r5344740);
        double r5344742 = r5344726 * r5344741;
        return r5344742;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5344743 = exp(1.0);
        double r5344744 = z;
        double r5344745 = log(r5344744);
        double r5344746 = t;
        double r5344747 = r5344745 - r5344746;
        double r5344748 = y;
        double r5344749 = a;
        double r5344750 = 1.0;
        double r5344751 = r5344744 / r5344750;
        double r5344752 = r5344751 * r5344751;
        double r5344753 = -0.5;
        double r5344754 = log(r5344750);
        double r5344755 = fma(r5344752, r5344753, r5344754);
        double r5344756 = b;
        double r5344757 = fma(r5344744, r5344750, r5344756);
        double r5344758 = r5344755 - r5344757;
        double r5344759 = r5344749 * r5344758;
        double r5344760 = fma(r5344747, r5344748, r5344759);
        double r5344761 = pow(r5344743, r5344760);
        double r5344762 = log1p(r5344761);
        double r5344763 = expm1(r5344762);
        double r5344764 = x;
        double r5344765 = r5344763 * r5344764;
        return r5344765;
}

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.7

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

    \[\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{-1}{2}, \frac{z}{1.0} \cdot \frac{z}{1.0}, \log 1.0 - 1.0 \cdot z\right)} - b\right) \cdot a\right)}\]
  5. Using strategy rm
  6. Applied expm1-log1p-u0.3

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

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

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

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

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

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

Reproduce

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