Average Error: 1.9 → 0.3
Time: 12.9s
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(y, \log z - t, a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)\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(y, \log z - t, a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)\right)} \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r135447 = x;
        double r135448 = y;
        double r135449 = z;
        double r135450 = log(r135449);
        double r135451 = t;
        double r135452 = r135450 - r135451;
        double r135453 = r135448 * r135452;
        double r135454 = a;
        double r135455 = 1.0;
        double r135456 = r135455 - r135449;
        double r135457 = log(r135456);
        double r135458 = b;
        double r135459 = r135457 - r135458;
        double r135460 = r135454 * r135459;
        double r135461 = r135453 + r135460;
        double r135462 = exp(r135461);
        double r135463 = r135447 * r135462;
        return r135463;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r135464 = y;
        double r135465 = z;
        double r135466 = log(r135465);
        double r135467 = t;
        double r135468 = r135466 - r135467;
        double r135469 = a;
        double r135470 = 1.0;
        double r135471 = log(r135470);
        double r135472 = 0.5;
        double r135473 = 2.0;
        double r135474 = pow(r135465, r135473);
        double r135475 = pow(r135470, r135473);
        double r135476 = r135474 / r135475;
        double r135477 = r135470 * r135465;
        double r135478 = fma(r135472, r135476, r135477);
        double r135479 = r135471 - r135478;
        double r135480 = b;
        double r135481 = r135479 - r135480;
        double r135482 = r135469 * r135481;
        double r135483 = fma(r135464, r135468, r135482);
        double r135484 = exp(r135483);
        double r135485 = x;
        double r135486 = r135484 * r135485;
        return r135486;
}

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

    \[\leadsto \color{blue}{e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \left(1 - z\right) - b\right)\right)} \cdot x}\]
  3. Taylor expanded around 0 0.3

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

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

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

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1 z)) b))))))