Average Error: 9.7 → 0.3
Time: 15.4s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(x, \log y, z \cdot \left(\log 1 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)\right) - t\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(x, \log y, z \cdot \left(\log 1 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)\right) - t
double f(double x, double y, double z, double t) {
        double r461161 = x;
        double r461162 = y;
        double r461163 = log(r461162);
        double r461164 = r461161 * r461163;
        double r461165 = z;
        double r461166 = 1.0;
        double r461167 = r461166 - r461162;
        double r461168 = log(r461167);
        double r461169 = r461165 * r461168;
        double r461170 = r461164 + r461169;
        double r461171 = t;
        double r461172 = r461170 - r461171;
        return r461172;
}

double f(double x, double y, double z, double t) {
        double r461173 = x;
        double r461174 = y;
        double r461175 = log(r461174);
        double r461176 = z;
        double r461177 = 1.0;
        double r461178 = log(r461177);
        double r461179 = 0.5;
        double r461180 = 2.0;
        double r461181 = pow(r461174, r461180);
        double r461182 = pow(r461177, r461180);
        double r461183 = r461181 / r461182;
        double r461184 = r461179 * r461183;
        double r461185 = fma(r461177, r461174, r461184);
        double r461186 = r461178 - r461185;
        double r461187 = r461176 * r461186;
        double r461188 = fma(r461173, r461175, r461187);
        double r461189 = t;
        double r461190 = r461188 - r461189;
        return r461190;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.7
Target0.2
Herbie0.3
\[\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.3333333333333333148296162562473909929395}{1 \cdot \left(1 \cdot 1\right)} \cdot \left(y \cdot \left(y \cdot y\right)\right)\right) - \left(t - x \cdot \log y\right)\]

Derivation

  1. Initial program 9.7

    \[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
  2. Simplified9.7

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \log y, z \cdot \log \left(1 - y\right)\right) - t}\]
  3. Taylor expanded around 0 0.3

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

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

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

Reproduce

herbie shell --seed 2019350 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1 (* 1 1))) (* y (* y y))))) (- t (* x (log y))))

  (- (+ (* x (log y)) (* z (log (- 1 y)))) t))