Average Error: 9.8 → 0.4
Time: 13.9s
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 - 1 \cdot y\right) - \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\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 - 1 \cdot y\right) - \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right) - t
double f(double x, double y, double z, double t) {
        double r396251 = x;
        double r396252 = y;
        double r396253 = log(r396252);
        double r396254 = r396251 * r396253;
        double r396255 = z;
        double r396256 = 1.0;
        double r396257 = r396256 - r396252;
        double r396258 = log(r396257);
        double r396259 = r396255 * r396258;
        double r396260 = r396254 + r396259;
        double r396261 = t;
        double r396262 = r396260 - r396261;
        return r396262;
}

double f(double x, double y, double z, double t) {
        double r396263 = x;
        double r396264 = y;
        double r396265 = log(r396264);
        double r396266 = z;
        double r396267 = 1.0;
        double r396268 = log(r396267);
        double r396269 = r396267 * r396264;
        double r396270 = r396268 - r396269;
        double r396271 = r396266 * r396270;
        double r396272 = 0.5;
        double r396273 = 2.0;
        double r396274 = pow(r396264, r396273);
        double r396275 = r396266 * r396274;
        double r396276 = pow(r396267, r396273);
        double r396277 = r396275 / r396276;
        double r396278 = r396272 * r396277;
        double r396279 = r396271 - r396278;
        double r396280 = fma(r396263, r396265, r396279);
        double r396281 = t;
        double r396282 = r396280 - r396281;
        return r396282;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

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

    \[\leadsto \mathsf{fma}\left(x, \log y, \color{blue}{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\]
  4. Simplified0.4

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

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

Reproduce

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