Average Error: 9.3 → 0.4
Time: 8.5s
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 r432895 = x;
        double r432896 = y;
        double r432897 = log(r432896);
        double r432898 = r432895 * r432897;
        double r432899 = z;
        double r432900 = 1.0;
        double r432901 = r432900 - r432896;
        double r432902 = log(r432901);
        double r432903 = r432899 * r432902;
        double r432904 = r432898 + r432903;
        double r432905 = t;
        double r432906 = r432904 - r432905;
        return r432906;
}

double f(double x, double y, double z, double t) {
        double r432907 = y;
        double r432908 = log(r432907);
        double r432909 = x;
        double r432910 = z;
        double r432911 = 1.0;
        double r432912 = log(r432911);
        double r432913 = r432911 * r432907;
        double r432914 = 0.5;
        double r432915 = 2.0;
        double r432916 = pow(r432907, r432915);
        double r432917 = pow(r432911, r432915);
        double r432918 = r432916 / r432917;
        double r432919 = r432914 * r432918;
        double r432920 = r432913 + r432919;
        double r432921 = r432912 - r432920;
        double r432922 = r432910 * r432921;
        double r432923 = t;
        double r432924 = r432922 - r432923;
        double r432925 = fma(r432908, r432909, r432924);
        return r432925;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

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

    \[\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 2020021 +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))