Average Error: 2.0 → 0.5
Time: 17.1s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[\log \left(e^{e^{\mathsf{fma}\left(y, \log z - t, \left(\log 1 - \mathsf{fma}\left(1, z, b\right)\right) \cdot a\right)}}\right) \cdot x\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\log \left(e^{e^{\mathsf{fma}\left(y, \log z - t, \left(\log 1 - \mathsf{fma}\left(1, z, b\right)\right) \cdot a\right)}}\right) \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r105337 = x;
        double r105338 = y;
        double r105339 = z;
        double r105340 = log(r105339);
        double r105341 = t;
        double r105342 = r105340 - r105341;
        double r105343 = r105338 * r105342;
        double r105344 = a;
        double r105345 = 1.0;
        double r105346 = r105345 - r105339;
        double r105347 = log(r105346);
        double r105348 = b;
        double r105349 = r105347 - r105348;
        double r105350 = r105344 * r105349;
        double r105351 = r105343 + r105350;
        double r105352 = exp(r105351);
        double r105353 = r105337 * r105352;
        return r105353;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r105354 = y;
        double r105355 = z;
        double r105356 = log(r105355);
        double r105357 = t;
        double r105358 = r105356 - r105357;
        double r105359 = 1.0;
        double r105360 = log(r105359);
        double r105361 = b;
        double r105362 = fma(r105359, r105355, r105361);
        double r105363 = r105360 - r105362;
        double r105364 = a;
        double r105365 = r105363 * r105364;
        double r105366 = fma(r105354, r105358, r105365);
        double r105367 = exp(r105366);
        double r105368 = exp(r105367);
        double r105369 = log(r105368);
        double r105370 = x;
        double r105371 = r105369 * r105370;
        return r105371;
}

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 2.0

    \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
  2. Simplified1.8

    \[\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.2

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

    \[\leadsto e^{\mathsf{fma}\left(y, \log z - t, \color{blue}{a \cdot \left(\left(\log 1 - b\right) - 1 \cdot z\right)}\right)} \cdot x\]
  5. Using strategy rm
  6. Applied add-log-exp0.5

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

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

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

Reproduce

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