Average Error: 1.9 → 0.2
Time: 12.2s
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(y, \log z - t, \mathsf{fma}\left(\sqrt{\log 1} + \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z}, \sqrt{\log 1} - \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z}, -b \cdot 1\right) \cdot a\right) + \mathsf{fma}\left(-b, 1, b \cdot 1\right) \cdot a}\]
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(y, \log z - t, \mathsf{fma}\left(\sqrt{\log 1} + \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z}, \sqrt{\log 1} - \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z}, -b \cdot 1\right) \cdot a\right) + \mathsf{fma}\left(-b, 1, b \cdot 1\right) \cdot a}
double f(double x, double y, double z, double t, double a, double b) {
        double r107462 = x;
        double r107463 = y;
        double r107464 = z;
        double r107465 = log(r107464);
        double r107466 = t;
        double r107467 = r107465 - r107466;
        double r107468 = r107463 * r107467;
        double r107469 = a;
        double r107470 = 1.0;
        double r107471 = r107470 - r107464;
        double r107472 = log(r107471);
        double r107473 = b;
        double r107474 = r107472 - r107473;
        double r107475 = r107469 * r107474;
        double r107476 = r107468 + r107475;
        double r107477 = exp(r107476);
        double r107478 = r107462 * r107477;
        return r107478;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r107479 = x;
        double r107480 = y;
        double r107481 = z;
        double r107482 = log(r107481);
        double r107483 = t;
        double r107484 = r107482 - r107483;
        double r107485 = 1.0;
        double r107486 = log(r107485);
        double r107487 = sqrt(r107486);
        double r107488 = 0.5;
        double r107489 = 2.0;
        double r107490 = pow(r107481, r107489);
        double r107491 = pow(r107485, r107489);
        double r107492 = r107490 / r107491;
        double r107493 = r107488 * r107492;
        double r107494 = r107485 * r107481;
        double r107495 = r107493 + r107494;
        double r107496 = sqrt(r107495);
        double r107497 = r107487 + r107496;
        double r107498 = r107487 - r107496;
        double r107499 = b;
        double r107500 = 1.0;
        double r107501 = r107499 * r107500;
        double r107502 = -r107501;
        double r107503 = fma(r107497, r107498, r107502);
        double r107504 = a;
        double r107505 = r107503 * r107504;
        double r107506 = fma(r107480, r107484, r107505);
        double r107507 = -r107499;
        double r107508 = fma(r107507, r107500, r107501);
        double r107509 = r107508 * r107504;
        double r107510 = r107506 + r107509;
        double r107511 = exp(r107510);
        double r107512 = r107479 * r107511;
        return r107512;
}

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

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + 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)}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.5

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \left(\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z\right)\right) - \color{blue}{1 \cdot b}\right)}\]
  5. Applied add-sqr-sqrt0.5

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\log 1 - \color{blue}{\sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z} \cdot \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z}}\right) - 1 \cdot b\right)}\]
  6. Applied add-sqr-sqrt0.5

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\color{blue}{\sqrt{\log 1} \cdot \sqrt{\log 1}} - \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z} \cdot \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z}\right) - 1 \cdot b\right)}\]
  7. Applied difference-of-squares0.5

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(\sqrt{\log 1} + \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z}\right) \cdot \left(\sqrt{\log 1} - \sqrt{\frac{1}{2} \cdot \frac{{z}^{2}}{{1}^{2}} + 1 \cdot z}\right)} - 1 \cdot b\right)}\]
  8. Applied prod-diff0.5

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

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

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

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

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

Reproduce

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