Average Error: 9.6 → 0.3
Time: 31.2s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1.0 - y\right)\right) - t\]
\[\mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{1.0} \cdot \frac{y}{1.0}, \frac{-1}{2}, \log 1.0 - y \cdot 1.0\right), z, \mathsf{fma}\left(\log y, x, -t\right)\right)\]
\left(x \cdot \log y + z \cdot \log \left(1.0 - y\right)\right) - t
\mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{1.0} \cdot \frac{y}{1.0}, \frac{-1}{2}, \log 1.0 - y \cdot 1.0\right), z, \mathsf{fma}\left(\log y, x, -t\right)\right)
double f(double x, double y, double z, double t) {
        double r10275431 = x;
        double r10275432 = y;
        double r10275433 = log(r10275432);
        double r10275434 = r10275431 * r10275433;
        double r10275435 = z;
        double r10275436 = 1.0;
        double r10275437 = r10275436 - r10275432;
        double r10275438 = log(r10275437);
        double r10275439 = r10275435 * r10275438;
        double r10275440 = r10275434 + r10275439;
        double r10275441 = t;
        double r10275442 = r10275440 - r10275441;
        return r10275442;
}

double f(double x, double y, double z, double t) {
        double r10275443 = y;
        double r10275444 = 1.0;
        double r10275445 = r10275443 / r10275444;
        double r10275446 = r10275445 * r10275445;
        double r10275447 = -0.5;
        double r10275448 = log(r10275444);
        double r10275449 = r10275443 * r10275444;
        double r10275450 = r10275448 - r10275449;
        double r10275451 = fma(r10275446, r10275447, r10275450);
        double r10275452 = z;
        double r10275453 = log(r10275443);
        double r10275454 = x;
        double r10275455 = t;
        double r10275456 = -r10275455;
        double r10275457 = fma(r10275453, r10275454, r10275456);
        double r10275458 = fma(r10275451, r10275452, r10275457);
        return r10275458;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

Derivation

  1. Initial program 9.6

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

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

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

    \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{y}{1.0} \cdot \frac{y}{1.0}, \frac{-1}{2}, \log 1.0 - 1.0 \cdot y\right)}, z, \log y \cdot x - t\right)\]
  5. Using strategy rm
  6. Applied fma-neg0.3

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

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

Reproduce

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

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

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