Average Error: 2.1 → 0.5
Time: 1.1m
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 \log \left(e^{e^{\mathsf{fma}\left(\mathsf{fma}\left(\frac{z}{1.0} \cdot \frac{-1}{2}, \frac{z}{1.0}, \log 1.0 - \mathsf{fma}\left(z, 1.0, b\right)\right), a, y \cdot \left(\log z - t\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 \log \left(e^{e^{\mathsf{fma}\left(\mathsf{fma}\left(\frac{z}{1.0} \cdot \frac{-1}{2}, \frac{z}{1.0}, \log 1.0 - \mathsf{fma}\left(z, 1.0, b\right)\right), a, y \cdot \left(\log z - t\right)\right)}}\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r5039993 = x;
        double r5039994 = y;
        double r5039995 = z;
        double r5039996 = log(r5039995);
        double r5039997 = t;
        double r5039998 = r5039996 - r5039997;
        double r5039999 = r5039994 * r5039998;
        double r5040000 = a;
        double r5040001 = 1.0;
        double r5040002 = r5040001 - r5039995;
        double r5040003 = log(r5040002);
        double r5040004 = b;
        double r5040005 = r5040003 - r5040004;
        double r5040006 = r5040000 * r5040005;
        double r5040007 = r5039999 + r5040006;
        double r5040008 = exp(r5040007);
        double r5040009 = r5039993 * r5040008;
        return r5040009;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5040010 = x;
        double r5040011 = z;
        double r5040012 = 1.0;
        double r5040013 = r5040011 / r5040012;
        double r5040014 = -0.5;
        double r5040015 = r5040013 * r5040014;
        double r5040016 = log(r5040012);
        double r5040017 = b;
        double r5040018 = fma(r5040011, r5040012, r5040017);
        double r5040019 = r5040016 - r5040018;
        double r5040020 = fma(r5040015, r5040013, r5040019);
        double r5040021 = a;
        double r5040022 = y;
        double r5040023 = log(r5040011);
        double r5040024 = t;
        double r5040025 = r5040023 - r5040024;
        double r5040026 = r5040022 * r5040025;
        double r5040027 = fma(r5040020, r5040021, r5040026);
        double r5040028 = exp(r5040027);
        double r5040029 = exp(r5040028);
        double r5040030 = log(r5040029);
        double r5040031 = r5040010 * r5040030;
        return r5040031;
}

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

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

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

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

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

    \[\leadsto x \cdot \color{blue}{\log \left(e^{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)}\]
  7. Simplified0.5

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

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

Reproduce

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