Average Error: 9.4 → 0.3
Time: 28.4s
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 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)\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 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)\right) - t
double f(double x, double y, double z, double t) {
        double r399862 = x;
        double r399863 = y;
        double r399864 = log(r399863);
        double r399865 = r399862 * r399864;
        double r399866 = z;
        double r399867 = 1.0;
        double r399868 = r399867 - r399863;
        double r399869 = log(r399868);
        double r399870 = r399866 * r399869;
        double r399871 = r399865 + r399870;
        double r399872 = t;
        double r399873 = r399871 - r399872;
        return r399873;
}

double f(double x, double y, double z, double t) {
        double r399874 = x;
        double r399875 = y;
        double r399876 = log(r399875);
        double r399877 = z;
        double r399878 = 1.0;
        double r399879 = log(r399878);
        double r399880 = 0.5;
        double r399881 = 2.0;
        double r399882 = pow(r399875, r399881);
        double r399883 = pow(r399878, r399881);
        double r399884 = r399882 / r399883;
        double r399885 = r399880 * r399884;
        double r399886 = fma(r399878, r399875, r399885);
        double r399887 = r399879 - r399886;
        double r399888 = r399877 * r399887;
        double r399889 = fma(r399874, r399876, r399888);
        double r399890 = t;
        double r399891 = r399889 - r399890;
        return r399891;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.4
Target0.2
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.4

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

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

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

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

Reproduce

herbie shell --seed 2019208 +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.333333333333333315 (* 1 (* 1 1))) (* y (* y y))))) (- t (* x (log y))))

  (- (+ (* x (log y)) (* z (log (- 1 y)))) t))