Average Error: 9.5 → 0.8
Time: 28.0s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{-1}{2}, \log 1 - y \cdot 1\right), z, \left(\sqrt[3]{\log y \cdot x} \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\log y}\right)\right) \cdot \sqrt[3]{\log y \cdot x} - t\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{-1}{2}, \log 1 - y \cdot 1\right), z, \left(\sqrt[3]{\log y \cdot x} \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\log y}\right)\right) \cdot \sqrt[3]{\log y \cdot x} - t\right)
double f(double x, double y, double z, double t) {
        double r20389371 = x;
        double r20389372 = y;
        double r20389373 = log(r20389372);
        double r20389374 = r20389371 * r20389373;
        double r20389375 = z;
        double r20389376 = 1.0;
        double r20389377 = r20389376 - r20389372;
        double r20389378 = log(r20389377);
        double r20389379 = r20389375 * r20389378;
        double r20389380 = r20389374 + r20389379;
        double r20389381 = t;
        double r20389382 = r20389380 - r20389381;
        return r20389382;
}

double f(double x, double y, double z, double t) {
        double r20389383 = y;
        double r20389384 = 1.0;
        double r20389385 = r20389383 / r20389384;
        double r20389386 = r20389385 * r20389385;
        double r20389387 = -0.5;
        double r20389388 = log(r20389384);
        double r20389389 = r20389383 * r20389384;
        double r20389390 = r20389388 - r20389389;
        double r20389391 = fma(r20389386, r20389387, r20389390);
        double r20389392 = z;
        double r20389393 = log(r20389383);
        double r20389394 = x;
        double r20389395 = r20389393 * r20389394;
        double r20389396 = cbrt(r20389395);
        double r20389397 = cbrt(r20389394);
        double r20389398 = cbrt(r20389393);
        double r20389399 = r20389397 * r20389398;
        double r20389400 = r20389396 * r20389399;
        double r20389401 = r20389400 * r20389396;
        double r20389402 = t;
        double r20389403 = r20389401 - r20389402;
        double r20389404 = fma(r20389391, r20389392, r20389403);
        return r20389404;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.5
Target0.3
Herbie0.8
\[\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.5

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

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

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

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

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{1} \cdot \frac{y}{1}, \frac{-1}{2}, \log 1 - 1 \cdot y\right), z, \color{blue}{\left(\sqrt[3]{\log y \cdot x} \cdot \sqrt[3]{\log y \cdot x}\right) \cdot \sqrt[3]{\log y \cdot x}} - t\right)\]
  7. Using strategy rm
  8. Applied cbrt-prod0.8

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

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

Reproduce

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