Average Error: 1.9 → 0.2
Time: 34.0s
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 r5179544 = x;
        double r5179545 = y;
        double r5179546 = z;
        double r5179547 = log(r5179546);
        double r5179548 = t;
        double r5179549 = r5179547 - r5179548;
        double r5179550 = r5179545 * r5179549;
        double r5179551 = a;
        double r5179552 = 1.0;
        double r5179553 = r5179552 - r5179546;
        double r5179554 = log(r5179553);
        double r5179555 = b;
        double r5179556 = r5179554 - r5179555;
        double r5179557 = r5179551 * r5179556;
        double r5179558 = r5179550 + r5179557;
        double r5179559 = exp(r5179558);
        double r5179560 = r5179544 * r5179559;
        return r5179560;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5179561 = x;
        double r5179562 = a;
        double r5179563 = -0.5;
        double r5179564 = 1.0;
        double r5179565 = z;
        double r5179566 = r5179564 * r5179565;
        double r5179567 = r5179563 * r5179566;
        double r5179568 = log(r5179564);
        double r5179569 = r5179568 - r5179566;
        double r5179570 = fma(r5179567, r5179565, r5179569);
        double r5179571 = b;
        double r5179572 = r5179570 - r5179571;
        double r5179573 = log(r5179565);
        double r5179574 = t;
        double r5179575 = r5179573 - r5179574;
        double r5179576 = y;
        double r5179577 = r5179575 * r5179576;
        double r5179578 = fma(r5179562, r5179572, r5179577);
        double r5179579 = exp(r5179578);
        double r5179580 = log1p(r5179579);
        double r5179581 = expm1(r5179580);
        double r5179582 = r5179561 * r5179581;
        return r5179582;
}

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