Average Error: 1.9 → 0.4
Time: 26.5s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[\begin{array}{l} \mathbf{if}\;y \le -0.1999076880385866339384648426857893355191 \lor \neg \left(y \le 1.846819950262495302832564822987673569233 \cdot 10^{-24}\right):\\ \;\;\;\;e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \left(1 - z\right) - b\right)\right)} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left({z}^{y} \cdot {1}^{a}\right) \cdot x}{e^{\mathsf{fma}\left(t, y, \mathsf{fma}\left(0.5, a \cdot {z}^{2}, a \cdot \mathsf{fma}\left(1, z, b\right)\right)\right)}}\\ \end{array}\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\begin{array}{l}
\mathbf{if}\;y \le -0.1999076880385866339384648426857893355191 \lor \neg \left(y \le 1.846819950262495302832564822987673569233 \cdot 10^{-24}\right):\\
\;\;\;\;e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \left(1 - z\right) - b\right)\right)} \cdot x\\

\mathbf{else}:\\
\;\;\;\;\frac{\left({z}^{y} \cdot {1}^{a}\right) \cdot x}{e^{\mathsf{fma}\left(t, y, \mathsf{fma}\left(0.5, a \cdot {z}^{2}, a \cdot \mathsf{fma}\left(1, z, b\right)\right)\right)}}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r107626 = x;
        double r107627 = y;
        double r107628 = z;
        double r107629 = log(r107628);
        double r107630 = t;
        double r107631 = r107629 - r107630;
        double r107632 = r107627 * r107631;
        double r107633 = a;
        double r107634 = 1.0;
        double r107635 = r107634 - r107628;
        double r107636 = log(r107635);
        double r107637 = b;
        double r107638 = r107636 - r107637;
        double r107639 = r107633 * r107638;
        double r107640 = r107632 + r107639;
        double r107641 = exp(r107640);
        double r107642 = r107626 * r107641;
        return r107642;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r107643 = y;
        double r107644 = -0.19990768803858663;
        bool r107645 = r107643 <= r107644;
        double r107646 = 1.8468199502624953e-24;
        bool r107647 = r107643 <= r107646;
        double r107648 = !r107647;
        bool r107649 = r107645 || r107648;
        double r107650 = z;
        double r107651 = log(r107650);
        double r107652 = t;
        double r107653 = r107651 - r107652;
        double r107654 = a;
        double r107655 = 1.0;
        double r107656 = r107655 - r107650;
        double r107657 = log(r107656);
        double r107658 = b;
        double r107659 = r107657 - r107658;
        double r107660 = r107654 * r107659;
        double r107661 = fma(r107643, r107653, r107660);
        double r107662 = exp(r107661);
        double r107663 = x;
        double r107664 = r107662 * r107663;
        double r107665 = pow(r107650, r107643);
        double r107666 = pow(r107655, r107654);
        double r107667 = r107665 * r107666;
        double r107668 = r107667 * r107663;
        double r107669 = 0.5;
        double r107670 = 2.0;
        double r107671 = pow(r107650, r107670);
        double r107672 = r107654 * r107671;
        double r107673 = fma(r107655, r107650, r107658);
        double r107674 = r107654 * r107673;
        double r107675 = fma(r107669, r107672, r107674);
        double r107676 = fma(r107652, r107643, r107675);
        double r107677 = exp(r107676);
        double r107678 = r107668 / r107677;
        double r107679 = r107649 ? r107664 : r107678;
        return r107679;
}

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. Split input into 2 regimes
  2. if y < -0.19990768803858663 or 1.8468199502624953e-24 < y

    1. Initial program 1.2

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
    2. Simplified0.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}\]

    if -0.19990768803858663 < y < 1.8468199502624953e-24

    1. Initial program 2.5

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

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

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

      \[\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. Taylor expanded around inf 0.0

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

      \[\leadsto \color{blue}{\frac{\left({z}^{y} \cdot {1}^{a}\right) \cdot x}{e^{\mathsf{fma}\left(t, y, \mathsf{fma}\left(0.5, a \cdot {z}^{2}, a \cdot \mathsf{fma}\left(1, z, b\right)\right)\right)}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -0.1999076880385866339384648426857893355191 \lor \neg \left(y \le 1.846819950262495302832564822987673569233 \cdot 10^{-24}\right):\\ \;\;\;\;e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \left(1 - z\right) - b\right)\right)} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left({z}^{y} \cdot {1}^{a}\right) \cdot x}{e^{\mathsf{fma}\left(t, y, \mathsf{fma}\left(0.5, a \cdot {z}^{2}, a \cdot \mathsf{fma}\left(1, z, b\right)\right)\right)}}\\ \end{array}\]

Reproduce

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