Average Error: 9.5 → 0.3
Time: 21.1s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(x, \log y, \mathsf{fma}\left(z, \log 1 - 1 \cdot y, \frac{z \cdot {y}^{2}}{{1}^{2}} \cdot \frac{-1}{2}\right)\right) - t\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(x, \log y, \mathsf{fma}\left(z, \log 1 - 1 \cdot y, \frac{z \cdot {y}^{2}}{{1}^{2}} \cdot \frac{-1}{2}\right)\right) - t
double f(double x, double y, double z, double t) {
        double r282110 = x;
        double r282111 = y;
        double r282112 = log(r282111);
        double r282113 = r282110 * r282112;
        double r282114 = z;
        double r282115 = 1.0;
        double r282116 = r282115 - r282111;
        double r282117 = log(r282116);
        double r282118 = r282114 * r282117;
        double r282119 = r282113 + r282118;
        double r282120 = t;
        double r282121 = r282119 - r282120;
        return r282121;
}

double f(double x, double y, double z, double t) {
        double r282122 = x;
        double r282123 = y;
        double r282124 = log(r282123);
        double r282125 = z;
        double r282126 = 1.0;
        double r282127 = log(r282126);
        double r282128 = r282126 * r282123;
        double r282129 = r282127 - r282128;
        double r282130 = 2.0;
        double r282131 = pow(r282123, r282130);
        double r282132 = r282125 * r282131;
        double r282133 = pow(r282126, r282130);
        double r282134 = r282132 / r282133;
        double r282135 = -0.5;
        double r282136 = r282134 * r282135;
        double r282137 = fma(r282125, r282129, r282136);
        double r282138 = fma(r282122, r282124, r282137);
        double r282139 = t;
        double r282140 = r282138 - r282139;
        return r282140;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.5
Target0.3
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.5

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

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

    \[\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.3

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

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

Reproduce

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