Average Error: 1.9 → 0.2
Time: 30.6s
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 \left(1.0 \cdot z\right), z, \log 1.0 - 1.0 \cdot z\right) - b, \left(\log z - t\right) \cdot y\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 \left(1.0 \cdot z\right), z, \log 1.0 - 1.0 \cdot z\right) - b, \left(\log z - t\right) \cdot y\right)}\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r6240046 = x;
        double r6240047 = y;
        double r6240048 = z;
        double r6240049 = log(r6240048);
        double r6240050 = t;
        double r6240051 = r6240049 - r6240050;
        double r6240052 = r6240047 * r6240051;
        double r6240053 = a;
        double r6240054 = 1.0;
        double r6240055 = r6240054 - r6240048;
        double r6240056 = log(r6240055);
        double r6240057 = b;
        double r6240058 = r6240056 - r6240057;
        double r6240059 = r6240053 * r6240058;
        double r6240060 = r6240052 + r6240059;
        double r6240061 = exp(r6240060);
        double r6240062 = r6240046 * r6240061;
        return r6240062;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6240063 = x;
        double r6240064 = a;
        double r6240065 = -0.5;
        double r6240066 = 1.0;
        double r6240067 = z;
        double r6240068 = r6240066 * r6240067;
        double r6240069 = r6240065 * r6240068;
        double r6240070 = log(r6240066);
        double r6240071 = r6240070 - r6240068;
        double r6240072 = fma(r6240069, r6240067, r6240071);
        double r6240073 = b;
        double r6240074 = r6240072 - r6240073;
        double r6240075 = log(r6240067);
        double r6240076 = t;
        double r6240077 = r6240075 - r6240076;
        double r6240078 = y;
        double r6240079 = r6240077 * r6240078;
        double r6240080 = fma(r6240064, r6240074, r6240079);
        double r6240081 = exp(r6240080);
        double r6240082 = log1p(r6240081);
        double r6240083 = expm1(r6240082);
        double r6240084 = r6240063 * r6240083;
        return r6240084;
}

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{-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. Taylor expanded around inf 0.2

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

    \[\leadsto x \cdot \color{blue}{e^{\mathsf{fma}\left(a, \mathsf{fma}\left(\frac{-1}{2} \cdot \left(1.0 \cdot z\right), z, \log 1.0 - 1.0 \cdot z\right) - b, y \cdot \left(\log z - t\right)\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 \left(1.0 \cdot z\right), z, \log 1.0 - 1.0 \cdot z\right) - b, y \cdot \left(\log z - t\right)\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 \left(1.0 \cdot z\right), z, \log 1.0 - 1.0 \cdot z\right) - b, \left(\log z - t\right) \cdot y\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))))))