Average Error: 2.2 → 0.3
Time: 28.1s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)\right)} \cdot x\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)\right)} \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r92120 = x;
        double r92121 = y;
        double r92122 = z;
        double r92123 = log(r92122);
        double r92124 = t;
        double r92125 = r92123 - r92124;
        double r92126 = r92121 * r92125;
        double r92127 = a;
        double r92128 = 1.0;
        double r92129 = r92128 - r92122;
        double r92130 = log(r92129);
        double r92131 = b;
        double r92132 = r92130 - r92131;
        double r92133 = r92127 * r92132;
        double r92134 = r92126 + r92133;
        double r92135 = exp(r92134);
        double r92136 = r92120 * r92135;
        return r92136;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r92137 = y;
        double r92138 = z;
        double r92139 = log(r92138);
        double r92140 = t;
        double r92141 = r92139 - r92140;
        double r92142 = a;
        double r92143 = 1.0;
        double r92144 = log(r92143);
        double r92145 = 0.5;
        double r92146 = 2.0;
        double r92147 = pow(r92138, r92146);
        double r92148 = pow(r92143, r92146);
        double r92149 = r92147 / r92148;
        double r92150 = r92143 * r92138;
        double r92151 = fma(r92145, r92149, r92150);
        double r92152 = r92144 - r92151;
        double r92153 = b;
        double r92154 = r92152 - r92153;
        double r92155 = r92142 * r92154;
        double r92156 = fma(r92137, r92141, r92155);
        double r92157 = exp(r92156);
        double r92158 = x;
        double r92159 = r92157 * r92158;
        return r92159;
}

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

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

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

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

    \[\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. Final simplification0.3

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

Reproduce

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