Average Error: 9.6 → 0.3
Time: 29.7s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{2}, \frac{y}{{1}^{2}} \cdot y, \mathsf{fma}\left(y, -1, \log 1\right)\right), z, -t\right)\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{2}, \frac{y}{{1}^{2}} \cdot y, \mathsf{fma}\left(y, -1, \log 1\right)\right), z, -t\right)\right)
double f(double x, double y, double z, double t) {
        double r306269 = x;
        double r306270 = y;
        double r306271 = log(r306270);
        double r306272 = r306269 * r306271;
        double r306273 = z;
        double r306274 = 1.0;
        double r306275 = r306274 - r306270;
        double r306276 = log(r306275);
        double r306277 = r306273 * r306276;
        double r306278 = r306272 + r306277;
        double r306279 = t;
        double r306280 = r306278 - r306279;
        return r306280;
}

double f(double x, double y, double z, double t) {
        double r306281 = y;
        double r306282 = log(r306281);
        double r306283 = x;
        double r306284 = -0.5;
        double r306285 = 1.0;
        double r306286 = 2.0;
        double r306287 = pow(r306285, r306286);
        double r306288 = r306281 / r306287;
        double r306289 = r306288 * r306281;
        double r306290 = -r306285;
        double r306291 = log(r306285);
        double r306292 = fma(r306281, r306290, r306291);
        double r306293 = fma(r306284, r306289, r306292);
        double r306294 = z;
        double r306295 = t;
        double r306296 = -r306295;
        double r306297 = fma(r306293, r306294, r306296);
        double r306298 = fma(r306282, r306283, r306297);
        return r306298;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.6
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.6

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

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

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

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

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

Reproduce

herbie shell --seed 2019174 +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) (* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))

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