Average Error: 9.6 → 0.4
Time: 16.8s
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(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \left(\frac{1}{2} \cdot \left(z \cdot {y}^{2}\right)\right) \cdot \frac{1}{{1}^{2}}\right)\right) - t\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(\log y, x, \mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \left(\frac{1}{2} \cdot \left(z \cdot {y}^{2}\right)\right) \cdot \frac{1}{{1}^{2}}\right)\right) - t\right)
double f(double x, double y, double z, double t) {
        double r2280 = x;
        double r2281 = y;
        double r2282 = log(r2281);
        double r2283 = r2280 * r2282;
        double r2284 = z;
        double r2285 = 1.0;
        double r2286 = r2285 - r2281;
        double r2287 = log(r2286);
        double r2288 = r2284 * r2287;
        double r2289 = r2283 + r2288;
        double r2290 = t;
        double r2291 = r2289 - r2290;
        return r2291;
}

double f(double x, double y, double z, double t) {
        double r2292 = y;
        double r2293 = log(r2292);
        double r2294 = x;
        double r2295 = z;
        double r2296 = 1.0;
        double r2297 = log(r2296);
        double r2298 = r2295 * r2292;
        double r2299 = 0.5;
        double r2300 = 2.0;
        double r2301 = pow(r2292, r2300);
        double r2302 = r2295 * r2301;
        double r2303 = r2299 * r2302;
        double r2304 = 1.0;
        double r2305 = pow(r2296, r2300);
        double r2306 = r2304 / r2305;
        double r2307 = r2303 * r2306;
        double r2308 = fma(r2296, r2298, r2307);
        double r2309 = -r2308;
        double r2310 = fma(r2295, r2297, r2309);
        double r2311 = t;
        double r2312 = r2310 - r2311;
        double r2313 = fma(r2293, r2294, r2312);
        return r2313;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.6
Target0.3
Herbie0.4
\[\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.333333333333333315}{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, z \cdot \log \left(1 - y\right) - t\right)}\]
  3. Taylor expanded around 0 0.4

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

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

    \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \color{blue}{\left(\left(z \cdot {y}^{2}\right) \cdot \frac{1}{{1}^{2}}\right)}\right)\right) - t\right)\]
  7. Applied associate-*r*0.4

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

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

Reproduce

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