Average Error: 5.8 → 1.1
Time: 24.7s
Precision: 64
\[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \frac{\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956}{x}\]
\[\left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(\frac{z}{\sqrt{x}} \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{\sqrt{x}} + \frac{0.0833333333333329956}{x}\right)\right) - x\]
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \frac{\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956}{x}
\left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(\frac{z}{\sqrt{x}} \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{\sqrt{x}} + \frac{0.0833333333333329956}{x}\right)\right) - x
double f(double x, double y, double z) {
        double r376665 = x;
        double r376666 = 0.5;
        double r376667 = r376665 - r376666;
        double r376668 = log(r376665);
        double r376669 = r376667 * r376668;
        double r376670 = r376669 - r376665;
        double r376671 = 0.91893853320467;
        double r376672 = r376670 + r376671;
        double r376673 = y;
        double r376674 = 0.0007936500793651;
        double r376675 = r376673 + r376674;
        double r376676 = z;
        double r376677 = r376675 * r376676;
        double r376678 = 0.0027777777777778;
        double r376679 = r376677 - r376678;
        double r376680 = r376679 * r376676;
        double r376681 = 0.083333333333333;
        double r376682 = r376680 + r376681;
        double r376683 = r376682 / r376665;
        double r376684 = r376672 + r376683;
        return r376684;
}

double f(double x, double y, double z) {
        double r376685 = x;
        double r376686 = 0.5;
        double r376687 = r376685 - r376686;
        double r376688 = log(r376685);
        double r376689 = 0.91893853320467;
        double r376690 = fma(r376687, r376688, r376689);
        double r376691 = z;
        double r376692 = sqrt(r376685);
        double r376693 = r376691 / r376692;
        double r376694 = y;
        double r376695 = 0.0007936500793651;
        double r376696 = r376694 + r376695;
        double r376697 = r376696 * r376691;
        double r376698 = 0.0027777777777778;
        double r376699 = r376697 - r376698;
        double r376700 = r376699 / r376692;
        double r376701 = r376693 * r376700;
        double r376702 = 0.083333333333333;
        double r376703 = r376702 / r376685;
        double r376704 = r376701 + r376703;
        double r376705 = r376690 + r376704;
        double r376706 = r376705 - r376685;
        return r376706;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original5.8
Target1.1
Herbie1.1
\[\left(\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467001 - x\right)\right) + \frac{0.0833333333333329956}{x}\right) + \frac{z}{x} \cdot \left(z \cdot \left(y + 7.93650079365100015 \cdot 10^{-4}\right) - 0.0027777777777778\right)\]

Derivation

  1. Initial program 5.8

    \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \frac{\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956}{x}\]
  2. Simplified5.8

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \frac{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}{x}\right) - x}\]
  3. Using strategy rm
  4. Applied clear-num5.9

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \color{blue}{\frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}}}\right) - x\]
  5. Using strategy rm
  6. Applied div-inv5.9

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \frac{1}{\color{blue}{x \cdot \frac{1}{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}}}\right) - x\]
  7. Applied add-cube-cbrt5.9

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{x \cdot \frac{1}{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}}\right) - x\]
  8. Applied times-frac5.9

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{x} \cdot \frac{\sqrt[3]{1}}{\frac{1}{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}}}\right) - x\]
  9. Simplified5.9

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \color{blue}{\frac{1}{x}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}}\right) - x\]
  10. Simplified5.9

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \frac{1}{x} \cdot \color{blue}{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}\right) - x\]
  11. Using strategy rm
  12. Applied fma-udef5.9

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \frac{1}{x} \cdot \color{blue}{\left(\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956\right)}\right) - x\]
  13. Applied distribute-lft-in5.9

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \color{blue}{\left(\frac{1}{x} \cdot \left(\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z\right) + \frac{1}{x} \cdot 0.0833333333333329956\right)}\right) - x\]
  14. Simplified2.1

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(\color{blue}{z \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{x}} + \frac{1}{x} \cdot 0.0833333333333329956\right)\right) - x\]
  15. Simplified2.0

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(z \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{x} + \color{blue}{\frac{0.0833333333333329956}{x}}\right)\right) - x\]
  16. Using strategy rm
  17. Applied add-sqr-sqrt2.1

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(z \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \frac{0.0833333333333329956}{x}\right)\right) - x\]
  18. Applied *-un-lft-identity2.1

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(z \cdot \frac{\color{blue}{1 \cdot \left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right)}}{\sqrt{x} \cdot \sqrt{x}} + \frac{0.0833333333333329956}{x}\right)\right) - x\]
  19. Applied times-frac2.1

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(z \cdot \color{blue}{\left(\frac{1}{\sqrt{x}} \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{\sqrt{x}}\right)} + \frac{0.0833333333333329956}{x}\right)\right) - x\]
  20. Applied associate-*r*1.1

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(\color{blue}{\left(z \cdot \frac{1}{\sqrt{x}}\right) \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{\sqrt{x}}} + \frac{0.0833333333333329956}{x}\right)\right) - x\]
  21. Simplified1.1

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(\color{blue}{\frac{z}{\sqrt{x}}} \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{\sqrt{x}} + \frac{0.0833333333333329956}{x}\right)\right) - x\]
  22. Final simplification1.1

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467001\right) + \left(\frac{z}{\sqrt{x}} \cdot \frac{\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778}{\sqrt{x}} + \frac{0.0833333333333329956}{x}\right)\right) - x\]

Reproduce

herbie shell --seed 2019198 +o rules:numerics
(FPCore (x y z)
  :name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"

  :herbie-target
  (+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))

  (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))