Average Error: 9.8 → 0.4
Time: 9.3s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(\log y, x, z \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{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, z \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right) - t\right)
double f(double x, double y, double z, double t) {
        double r406236 = x;
        double r406237 = y;
        double r406238 = log(r406237);
        double r406239 = r406236 * r406238;
        double r406240 = z;
        double r406241 = 1.0;
        double r406242 = r406241 - r406237;
        double r406243 = log(r406242);
        double r406244 = r406240 * r406243;
        double r406245 = r406239 + r406244;
        double r406246 = t;
        double r406247 = r406245 - r406246;
        return r406247;
}

double f(double x, double y, double z, double t) {
        double r406248 = y;
        double r406249 = log(r406248);
        double r406250 = x;
        double r406251 = z;
        double r406252 = 1.0;
        double r406253 = log(r406252);
        double r406254 = r406252 * r406248;
        double r406255 = 0.5;
        double r406256 = 2.0;
        double r406257 = pow(r406248, r406256);
        double r406258 = pow(r406252, r406256);
        double r406259 = r406257 / r406258;
        double r406260 = r406255 * r406259;
        double r406261 = r406254 + r406260;
        double r406262 = r406253 - r406261;
        double r406263 = r406251 * r406262;
        double r406264 = t;
        double r406265 = r406263 - r406264;
        double r406266 = fma(r406249, r406250, r406265);
        return r406266;
}

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(\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, z \cdot \color{blue}{\left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)} - t\right)\]
  4. Final simplification0.4

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

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))