Average Error: 1.9 → 0.3
Time: 30.4s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[e^{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(1, z, \mathsf{fma}\left(\frac{z}{1} \cdot \frac{z}{1}, \frac{1}{2}, b\right)\right), a, \left(\log z - t\right) \cdot y\right)} \cdot x\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
e^{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(1, z, \mathsf{fma}\left(\frac{z}{1} \cdot \frac{z}{1}, \frac{1}{2}, b\right)\right), a, \left(\log z - t\right) \cdot y\right)} \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r5583311 = x;
        double r5583312 = y;
        double r5583313 = z;
        double r5583314 = log(r5583313);
        double r5583315 = t;
        double r5583316 = r5583314 - r5583315;
        double r5583317 = r5583312 * r5583316;
        double r5583318 = a;
        double r5583319 = 1.0;
        double r5583320 = r5583319 - r5583313;
        double r5583321 = log(r5583320);
        double r5583322 = b;
        double r5583323 = r5583321 - r5583322;
        double r5583324 = r5583318 * r5583323;
        double r5583325 = r5583317 + r5583324;
        double r5583326 = exp(r5583325);
        double r5583327 = r5583311 * r5583326;
        return r5583327;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r5583328 = 1.0;
        double r5583329 = log(r5583328);
        double r5583330 = z;
        double r5583331 = r5583330 / r5583328;
        double r5583332 = r5583331 * r5583331;
        double r5583333 = 0.5;
        double r5583334 = b;
        double r5583335 = fma(r5583332, r5583333, r5583334);
        double r5583336 = fma(r5583328, r5583330, r5583335);
        double r5583337 = r5583329 - r5583336;
        double r5583338 = a;
        double r5583339 = log(r5583330);
        double r5583340 = t;
        double r5583341 = r5583339 - r5583340;
        double r5583342 = y;
        double r5583343 = r5583341 * r5583342;
        double r5583344 = fma(r5583337, r5583338, r5583343);
        double r5583345 = exp(r5583344);
        double r5583346 = x;
        double r5583347 = r5583345 * r5583346;
        return r5583347;
}

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 - z\right) - b\right)}\]
  2. Simplified1.6

    \[\leadsto \color{blue}{x \cdot e^{\mathsf{fma}\left(y, \log z - t, \left(\log \left(1 - 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 - \left(1 \cdot z + \frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{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}{\left(\log 1 - \mathsf{fma}\left(z, 1, \left(\frac{z}{1} \cdot \frac{z}{1}\right) \cdot \frac{1}{2}\right)\right)} - b\right) \cdot a\right)}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity0.3

    \[\leadsto \color{blue}{\left(1 \cdot x\right)} \cdot e^{\mathsf{fma}\left(y, \log z - t, \left(\left(\log 1 - \mathsf{fma}\left(z, 1, \left(\frac{z}{1} \cdot \frac{z}{1}\right) \cdot \frac{1}{2}\right)\right) - b\right) \cdot a\right)}\]
  7. Applied associate-*l*0.3

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

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

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

Reproduce

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