Average Error: 9.7 → 0.4
Time: 7.8s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\left(\mathsf{fma}\left(x, 2 \cdot \log \left(\sqrt[3]{y}\right), x \cdot \log \left(\sqrt[3]{y}\right)\right) + \mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right)\right) - t\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\left(\mathsf{fma}\left(x, 2 \cdot \log \left(\sqrt[3]{y}\right), x \cdot \log \left(\sqrt[3]{y}\right)\right) + \mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right)\right) - t
double f(double x, double y, double z, double t) {
        double r373865 = x;
        double r373866 = y;
        double r373867 = log(r373866);
        double r373868 = r373865 * r373867;
        double r373869 = z;
        double r373870 = 1.0;
        double r373871 = r373870 - r373866;
        double r373872 = log(r373871);
        double r373873 = r373869 * r373872;
        double r373874 = r373868 + r373873;
        double r373875 = t;
        double r373876 = r373874 - r373875;
        return r373876;
}

double f(double x, double y, double z, double t) {
        double r373877 = x;
        double r373878 = 2.0;
        double r373879 = y;
        double r373880 = cbrt(r373879);
        double r373881 = log(r373880);
        double r373882 = r373878 * r373881;
        double r373883 = r373877 * r373881;
        double r373884 = fma(r373877, r373882, r373883);
        double r373885 = z;
        double r373886 = 1.0;
        double r373887 = log(r373886);
        double r373888 = r373885 * r373879;
        double r373889 = 0.5;
        double r373890 = pow(r373879, r373878);
        double r373891 = r373885 * r373890;
        double r373892 = pow(r373886, r373878);
        double r373893 = r373891 / r373892;
        double r373894 = r373889 * r373893;
        double r373895 = fma(r373886, r373888, r373894);
        double r373896 = -r373895;
        double r373897 = fma(r373885, r373887, r373896);
        double r373898 = r373884 + r373897;
        double r373899 = t;
        double r373900 = r373898 - r373899;
        return r373900;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

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

    \[\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(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)}\right) - t\]
  3. Simplified0.4

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

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

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

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

    \[\leadsto \left(\left(\color{blue}{x \cdot \left(2 \cdot \log \left(\sqrt[3]{y}\right)\right)} + x \cdot \log \left(\sqrt[3]{y}\right)\right) + \mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right)\right) - t\]
  9. Using strategy rm
  10. Applied fma-def0.4

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

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

Reproduce

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