Average Error: 2.1 → 0.3
Time: 33.4s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}\]
\[\left(\sqrt{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)}} \cdot \sqrt{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) \cdot x\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1.0 - z\right) - b\right)}
\left(\sqrt{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)}} \cdot \sqrt{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) \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r5542983 = x;
        double r5542984 = y;
        double r5542985 = z;
        double r5542986 = log(r5542985);
        double r5542987 = t;
        double r5542988 = r5542986 - r5542987;
        double r5542989 = r5542984 * r5542988;
        double r5542990 = a;
        double r5542991 = 1.0;
        double r5542992 = r5542991 - r5542985;
        double r5542993 = log(r5542992);
        double r5542994 = b;
        double r5542995 = r5542993 - r5542994;
        double r5542996 = r5542990 * r5542995;
        double r5542997 = r5542989 + r5542996;
        double r5542998 = exp(r5542997);
        double r5542999 = r5542983 * r5542998;
        return r5542999;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5543000 = y;
        double r5543001 = z;
        double r5543002 = log(r5543001);
        double r5543003 = t;
        double r5543004 = r5543002 - r5543003;
        double r5543005 = -0.5;
        double r5543006 = 1.0;
        double r5543007 = r5543001 / r5543006;
        double r5543008 = r5543007 * r5543007;
        double r5543009 = log(r5543006);
        double r5543010 = r5543006 * r5543001;
        double r5543011 = r5543009 - r5543010;
        double r5543012 = fma(r5543005, r5543008, r5543011);
        double r5543013 = b;
        double r5543014 = r5543012 - r5543013;
        double r5543015 = a;
        double r5543016 = r5543014 * r5543015;
        double r5543017 = fma(r5543000, r5543004, r5543016);
        double r5543018 = exp(r5543017);
        double r5543019 = sqrt(r5543018);
        double r5543020 = r5543019 * r5543019;
        double r5543021 = x;
        double r5543022 = r5543020 * r5543021;
        return r5543022;
}

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-sqr-sqrt0.3

    \[\leadsto x \cdot \color{blue}{\left(\sqrt{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)}} \cdot \sqrt{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. Final simplification0.3

    \[\leadsto \left(\sqrt{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)}} \cdot \sqrt{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) \cdot x\]

Reproduce

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