Average Error: 9.6 → 0.4
Time: 21.7s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\left(\left(\mathsf{fma}\left(-y, 1, y \cdot 1\right) \cdot z - \left(0.5 \cdot z\right) \cdot \left(y \cdot y\right)\right) + \mathsf{fma}\left(\log 1 + \left(-y\right) \cdot 1, z, x \cdot \log y\right)\right) - t\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(\left(\mathsf{fma}\left(-y, 1, y \cdot 1\right) \cdot z - \left(0.5 \cdot z\right) \cdot \left(y \cdot y\right)\right) + \mathsf{fma}\left(\log 1 + \left(-y\right) \cdot 1, z, x \cdot \log y\right)\right) - t
double f(double x, double y, double z, double t) {
        double r394153 = x;
        double r394154 = y;
        double r394155 = log(r394154);
        double r394156 = r394153 * r394155;
        double r394157 = z;
        double r394158 = 1.0;
        double r394159 = r394158 - r394154;
        double r394160 = log(r394159);
        double r394161 = r394157 * r394160;
        double r394162 = r394156 + r394161;
        double r394163 = t;
        double r394164 = r394162 - r394163;
        return r394164;
}

double f(double x, double y, double z, double t) {
        double r394165 = y;
        double r394166 = -r394165;
        double r394167 = 1.0;
        double r394168 = r394165 * r394167;
        double r394169 = fma(r394166, r394167, r394168);
        double r394170 = z;
        double r394171 = r394169 * r394170;
        double r394172 = 0.5;
        double r394173 = r394172 * r394170;
        double r394174 = r394165 * r394165;
        double r394175 = r394173 * r394174;
        double r394176 = r394171 - r394175;
        double r394177 = log(r394167);
        double r394178 = r394166 * r394167;
        double r394179 = r394177 + r394178;
        double r394180 = x;
        double r394181 = log(r394165);
        double r394182 = r394180 * r394181;
        double r394183 = fma(r394179, r394170, r394182);
        double r394184 = r394176 + r394183;
        double r394185 = t;
        double r394186 = r394184 - r394185;
        return r394186;
}

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.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.6

    \[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
  2. Taylor expanded around 0 0.4

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

    \[\leadsto \left(x \cdot \log y + \color{blue}{\left(z \cdot \left(\log 1 - 1 \cdot y\right) - \frac{z \cdot \frac{1}{2}}{1} \cdot \frac{{y}^{2}}{1}\right)}\right) - t\]
  4. Using strategy rm
  5. Applied pow10.4

    \[\leadsto \left(x \cdot \log y + \left(z \cdot \left(\log \color{blue}{\left({1}^{1}\right)} - 1 \cdot y\right) - \frac{z \cdot \frac{1}{2}}{1} \cdot \frac{{y}^{2}}{1}\right)\right) - t\]
  6. Applied log-pow0.4

    \[\leadsto \left(x \cdot \log y + \left(z \cdot \left(\color{blue}{1 \cdot \log 1} - 1 \cdot y\right) - \frac{z \cdot \frac{1}{2}}{1} \cdot \frac{{y}^{2}}{1}\right)\right) - t\]
  7. Applied prod-diff0.4

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

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

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

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

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

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

    \[\leadsto \left(\mathsf{fma}\left(\log 1 + \left(-1\right) \cdot y, z, x \cdot \log y\right) + \left(z \cdot \mathsf{fma}\left(-y, 1, y \cdot 1\right) - \color{blue}{\left(0.5 \cdot z\right) \cdot \left(y \cdot y\right)}\right)\right) - t\]
  14. Final simplification0.4

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

Reproduce

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