Average Error: 1.8 → 0.3
Time: 33.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(\log z - t, y, \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) \cdot a\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(\log z - t, y, \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) \cdot a\right)}\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r6126476 = x;
        double r6126477 = y;
        double r6126478 = z;
        double r6126479 = log(r6126478);
        double r6126480 = t;
        double r6126481 = r6126479 - r6126480;
        double r6126482 = r6126477 * r6126481;
        double r6126483 = a;
        double r6126484 = 1.0;
        double r6126485 = r6126484 - r6126478;
        double r6126486 = log(r6126485);
        double r6126487 = b;
        double r6126488 = r6126486 - r6126487;
        double r6126489 = r6126483 * r6126488;
        double r6126490 = r6126482 + r6126489;
        double r6126491 = exp(r6126490);
        double r6126492 = r6126476 * r6126491;
        return r6126492;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6126493 = x;
        double r6126494 = z;
        double r6126495 = log(r6126494);
        double r6126496 = t;
        double r6126497 = r6126495 - r6126496;
        double r6126498 = y;
        double r6126499 = 1.0;
        double r6126500 = r6126494 / r6126499;
        double r6126501 = r6126500 * r6126500;
        double r6126502 = -0.5;
        double r6126503 = log(r6126499);
        double r6126504 = fma(r6126501, r6126502, r6126503);
        double r6126505 = b;
        double r6126506 = fma(r6126494, r6126499, r6126505);
        double r6126507 = r6126504 - r6126506;
        double r6126508 = a;
        double r6126509 = r6126507 * r6126508;
        double r6126510 = fma(r6126497, r6126498, r6126509);
        double r6126511 = exp(r6126510);
        double r6126512 = log1p(r6126511);
        double r6126513 = expm1(r6126512);
        double r6126514 = r6126493 * r6126513;
        return r6126514;
}

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

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

    \[\leadsto x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(e^{\mathsf{fma}\left(\log z - t, y, \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) \cdot a\right)}\right)\right)\]

Reproduce

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