Average Error: 2.0 → 0.3
Time: 31.7s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[x \cdot e^{\mathsf{fma}\left(\left(\log 1 - \mathsf{fma}\left(\frac{\frac{1}{2}}{1}, \frac{z \cdot z}{1}, z \cdot 1\right)\right) - b, a, t \cdot \left(-y\right)\right) + \log z \cdot y}\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
x \cdot e^{\mathsf{fma}\left(\left(\log 1 - \mathsf{fma}\left(\frac{\frac{1}{2}}{1}, \frac{z \cdot z}{1}, z \cdot 1\right)\right) - b, a, t \cdot \left(-y\right)\right) + \log z \cdot y}
double f(double x, double y, double z, double t, double a, double b) {
        double r100472 = x;
        double r100473 = y;
        double r100474 = z;
        double r100475 = log(r100474);
        double r100476 = t;
        double r100477 = r100475 - r100476;
        double r100478 = r100473 * r100477;
        double r100479 = a;
        double r100480 = 1.0;
        double r100481 = r100480 - r100474;
        double r100482 = log(r100481);
        double r100483 = b;
        double r100484 = r100482 - r100483;
        double r100485 = r100479 * r100484;
        double r100486 = r100478 + r100485;
        double r100487 = exp(r100486);
        double r100488 = r100472 * r100487;
        return r100488;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r100489 = x;
        double r100490 = 1.0;
        double r100491 = log(r100490);
        double r100492 = 0.5;
        double r100493 = r100492 / r100490;
        double r100494 = z;
        double r100495 = r100494 * r100494;
        double r100496 = r100495 / r100490;
        double r100497 = r100494 * r100490;
        double r100498 = fma(r100493, r100496, r100497);
        double r100499 = r100491 - r100498;
        double r100500 = b;
        double r100501 = r100499 - r100500;
        double r100502 = a;
        double r100503 = t;
        double r100504 = y;
        double r100505 = -r100504;
        double r100506 = r100503 * r100505;
        double r100507 = fma(r100501, r100502, r100506);
        double r100508 = log(r100494);
        double r100509 = r100508 * r100504;
        double r100510 = r100507 + r100509;
        double r100511 = exp(r100510);
        double r100512 = r100489 * r100511;
        return r100512;
}

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. Taylor expanded around 0 0.4

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

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(\log 1 - \mathsf{fma}\left(\frac{\frac{1}{2}}{1}, \frac{{z}^{2}}{1}, z \cdot 1\right)\right)} - b\right)}\]
  4. Using strategy rm
  5. Applied sub-neg0.4

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

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

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

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

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

Reproduce

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