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 r103801 = x;
        double r103802 = y;
        double r103803 = z;
        double r103804 = log(r103803);
        double r103805 = t;
        double r103806 = r103804 - r103805;
        double r103807 = r103802 * r103806;
        double r103808 = a;
        double r103809 = 1.0;
        double r103810 = r103809 - r103803;
        double r103811 = log(r103810);
        double r103812 = b;
        double r103813 = r103811 - r103812;
        double r103814 = r103808 * r103813;
        double r103815 = r103807 + r103814;
        double r103816 = exp(r103815);
        double r103817 = r103801 * r103816;
        return r103817;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r103818 = x;
        double r103819 = y;
        double r103820 = z;
        double r103821 = log(r103820);
        double r103822 = t;
        double r103823 = r103821 - r103822;
        double r103824 = 1.0;
        double r103825 = log(r103824);
        double r103826 = sqrt(r103825);
        double r103827 = 0.5;
        double r103828 = 2.0;
        double r103829 = pow(r103820, r103828);
        double r103830 = pow(r103824, r103828);
        double r103831 = r103829 / r103830;
        double r103832 = r103827 * r103831;
        double r103833 = r103824 * r103820;
        double r103834 = r103832 + r103833;
        double r103835 = sqrt(r103834);
        double r103836 = r103826 + r103835;
        double r103837 = r103826 - r103835;
        double r103838 = b;
        double r103839 = 1.0;
        double r103840 = r103838 * r103839;
        double r103841 = -r103840;
        double r103842 = fma(r103836, r103837, r103841);
        double r103843 = a;
        double r103844 = r103842 * r103843;
        double r103845 = fma(r103819, r103823, r103844);
        double r103846 = -r103838;
        double r103847 = fma(r103846, r103839, r103840);
        double r103848 = r103847 * r103843;
        double r103849 = r103845 + r103848;
        double r103850 = exp(r103849);
        double r103851 = r103818 * r103850;
        return r103851;
}

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