Average Error: 5.7 → 4.2
Time: 23.2s
Precision: 64
\[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.9189385332046700050057097541866824030876\right) + \frac{\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321\right) \cdot z + 0.08333333333333299564049667651488562114537}{x}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.220890695010470087568016663424145810024 \cdot 10^{154}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - x \cdot \left(-\log x\right)\right) + \frac{1}{\mathsf{fma}\left(0.4000000000000064059868520871532382443547, x \cdot z, 12.00000000000004796163466380676254630089 \cdot x\right) - 0.1009522780952416126654114236771420110017 \cdot \left(x \cdot {z}^{2}\right)}\right) - x\\ \mathbf{elif}\;z \le 4.209233512697917048429572331592439435071 \cdot 10^{50}:\\ \;\;\;\;\left(\frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}} + \left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \left(-\left(\log \left(\sqrt[3]{x}\right) \cdot x + \left(2 \cdot \log \left(\sqrt[3]{x}\right)\right) \cdot x\right)\right)\right)\right) - x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{{z}^{2}}{x}, y, \mathsf{fma}\left(\frac{{z}^{2}}{x}, 7.936500793651000149400709382518925849581 \cdot 10^{-4}, \mathsf{fma}\left(\log x, x, -x\right)\right)\right)\\ \end{array}\]
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.9189385332046700050057097541866824030876\right) + \frac{\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321\right) \cdot z + 0.08333333333333299564049667651488562114537}{x}
\begin{array}{l}
\mathbf{if}\;z \le -3.220890695010470087568016663424145810024 \cdot 10^{154}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - x \cdot \left(-\log x\right)\right) + \frac{1}{\mathsf{fma}\left(0.4000000000000064059868520871532382443547, x \cdot z, 12.00000000000004796163466380676254630089 \cdot x\right) - 0.1009522780952416126654114236771420110017 \cdot \left(x \cdot {z}^{2}\right)}\right) - x\\

\mathbf{elif}\;z \le 4.209233512697917048429572331592439435071 \cdot 10^{50}:\\
\;\;\;\;\left(\frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}} + \left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \left(-\left(\log \left(\sqrt[3]{x}\right) \cdot x + \left(2 \cdot \log \left(\sqrt[3]{x}\right)\right) \cdot x\right)\right)\right)\right) - x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{{z}^{2}}{x}, y, \mathsf{fma}\left(\frac{{z}^{2}}{x}, 7.936500793651000149400709382518925849581 \cdot 10^{-4}, \mathsf{fma}\left(\log x, x, -x\right)\right)\right)\\

\end{array}
double f(double x, double y, double z) {
        double r294548 = x;
        double r294549 = 0.5;
        double r294550 = r294548 - r294549;
        double r294551 = log(r294548);
        double r294552 = r294550 * r294551;
        double r294553 = r294552 - r294548;
        double r294554 = 0.91893853320467;
        double r294555 = r294553 + r294554;
        double r294556 = y;
        double r294557 = 0.0007936500793651;
        double r294558 = r294556 + r294557;
        double r294559 = z;
        double r294560 = r294558 * r294559;
        double r294561 = 0.0027777777777778;
        double r294562 = r294560 - r294561;
        double r294563 = r294562 * r294559;
        double r294564 = 0.083333333333333;
        double r294565 = r294563 + r294564;
        double r294566 = r294565 / r294548;
        double r294567 = r294555 + r294566;
        return r294567;
}

double f(double x, double y, double z) {
        double r294568 = z;
        double r294569 = -3.22089069501047e+154;
        bool r294570 = r294568 <= r294569;
        double r294571 = 0.5;
        double r294572 = x;
        double r294573 = log(r294572);
        double r294574 = -r294573;
        double r294575 = 0.91893853320467;
        double r294576 = fma(r294571, r294574, r294575);
        double r294577 = r294572 * r294574;
        double r294578 = r294576 - r294577;
        double r294579 = 1.0;
        double r294580 = 0.4000000000000064;
        double r294581 = r294572 * r294568;
        double r294582 = 12.000000000000048;
        double r294583 = r294582 * r294572;
        double r294584 = fma(r294580, r294581, r294583);
        double r294585 = 0.10095227809524161;
        double r294586 = 2.0;
        double r294587 = pow(r294568, r294586);
        double r294588 = r294572 * r294587;
        double r294589 = r294585 * r294588;
        double r294590 = r294584 - r294589;
        double r294591 = r294579 / r294590;
        double r294592 = r294578 + r294591;
        double r294593 = r294592 - r294572;
        double r294594 = 4.209233512697917e+50;
        bool r294595 = r294568 <= r294594;
        double r294596 = y;
        double r294597 = 0.0007936500793651;
        double r294598 = r294596 + r294597;
        double r294599 = r294598 * r294568;
        double r294600 = 0.0027777777777778;
        double r294601 = r294599 - r294600;
        double r294602 = 0.083333333333333;
        double r294603 = fma(r294601, r294568, r294602);
        double r294604 = r294572 / r294603;
        double r294605 = r294579 / r294604;
        double r294606 = cbrt(r294572);
        double r294607 = log(r294606);
        double r294608 = r294607 * r294572;
        double r294609 = r294586 * r294607;
        double r294610 = r294609 * r294572;
        double r294611 = r294608 + r294610;
        double r294612 = -r294611;
        double r294613 = r294576 - r294612;
        double r294614 = r294605 + r294613;
        double r294615 = r294614 - r294572;
        double r294616 = r294587 / r294572;
        double r294617 = -r294572;
        double r294618 = fma(r294573, r294572, r294617);
        double r294619 = fma(r294616, r294597, r294618);
        double r294620 = fma(r294616, r294596, r294619);
        double r294621 = r294595 ? r294615 : r294620;
        double r294622 = r294570 ? r294593 : r294621;
        return r294622;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original5.7
Target1.2
Herbie4.2
\[\left(\left(\left(x - 0.5\right) \cdot \log x + \left(0.9189385332046700050057097541866824030876 - x\right)\right) + \frac{0.08333333333333299564049667651488562114537}{x}\right) + \frac{z}{x} \cdot \left(z \cdot \left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) - 0.002777777777777800001512975569539776188321\right)\]

Derivation

  1. Split input into 3 regimes
  2. if z < -3.22089069501047e+154

    1. Initial program 63.2

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.9189385332046700050057097541866824030876\right) + \frac{\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321\right) \cdot z + 0.08333333333333299564049667651488562114537}{x}\]
    2. Simplified63.2

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x - 0.5, \log x, 0.9189385332046700050057097541866824030876\right) + \frac{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}{x}\right) - x}\]
    3. Using strategy rm
    4. Applied clear-num63.2

      \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.9189385332046700050057097541866824030876\right) + \color{blue}{\frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}}\right) - x\]
    5. Taylor expanded around inf 63.2

      \[\leadsto \left(\color{blue}{\left(\left(0.5 \cdot \log \left(\frac{1}{x}\right) + 0.9189385332046700050057097541866824030876\right) - x \cdot \log \left(\frac{1}{x}\right)\right)} + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    6. Simplified63.2

      \[\leadsto \left(\color{blue}{\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - x \cdot \left(-\log x\right)\right)} + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    7. Taylor expanded around 0 30.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - x \cdot \left(-\log x\right)\right) + \frac{1}{\color{blue}{\left(0.4000000000000064059868520871532382443547 \cdot \left(x \cdot z\right) + 12.00000000000004796163466380676254630089 \cdot x\right) - 0.1009522780952416126654114236771420110017 \cdot \left(x \cdot {z}^{2}\right)}}\right) - x\]
    8. Simplified30.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - x \cdot \left(-\log x\right)\right) + \frac{1}{\color{blue}{\mathsf{fma}\left(0.4000000000000064059868520871532382443547, x \cdot z, 12.00000000000004796163466380676254630089 \cdot x\right) - 0.1009522780952416126654114236771420110017 \cdot \left(x \cdot {z}^{2}\right)}}\right) - x\]

    if -3.22089069501047e+154 < z < 4.209233512697917e+50

    1. Initial program 1.4

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.9189385332046700050057097541866824030876\right) + \frac{\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321\right) \cdot z + 0.08333333333333299564049667651488562114537}{x}\]
    2. Simplified1.4

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x - 0.5, \log x, 0.9189385332046700050057097541866824030876\right) + \frac{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}{x}\right) - x}\]
    3. Using strategy rm
    4. Applied clear-num1.5

      \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.9189385332046700050057097541866824030876\right) + \color{blue}{\frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}}\right) - x\]
    5. Taylor expanded around inf 1.5

      \[\leadsto \left(\color{blue}{\left(\left(0.5 \cdot \log \left(\frac{1}{x}\right) + 0.9189385332046700050057097541866824030876\right) - x \cdot \log \left(\frac{1}{x}\right)\right)} + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    6. Simplified1.5

      \[\leadsto \left(\color{blue}{\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - x \cdot \left(-\log x\right)\right)} + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    7. Using strategy rm
    8. Applied add-sqr-sqrt1.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left(-\log x\right)\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    9. Applied associate-*l*1.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \color{blue}{\sqrt{x} \cdot \left(\sqrt{x} \cdot \left(-\log x\right)\right)}\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    10. Using strategy rm
    11. Applied add-cube-cbrt1.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \sqrt{x} \cdot \left(\sqrt{x} \cdot \left(-\log \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)}\right)\right)\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    12. Applied log-prod1.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \sqrt{x} \cdot \left(\sqrt{x} \cdot \left(-\color{blue}{\left(\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \log \left(\sqrt[3]{x}\right)\right)}\right)\right)\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    13. Applied distribute-neg-in1.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \sqrt{x} \cdot \left(\sqrt{x} \cdot \color{blue}{\left(\left(-\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right) + \left(-\log \left(\sqrt[3]{x}\right)\right)\right)}\right)\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    14. Applied distribute-lft-in1.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \sqrt{x} \cdot \color{blue}{\left(\sqrt{x} \cdot \left(-\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right) + \sqrt{x} \cdot \left(-\log \left(\sqrt[3]{x}\right)\right)\right)}\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    15. Applied distribute-lft-in1.6

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \color{blue}{\left(\sqrt{x} \cdot \left(\sqrt{x} \cdot \left(-\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right)\right) + \sqrt{x} \cdot \left(\sqrt{x} \cdot \left(-\log \left(\sqrt[3]{x}\right)\right)\right)\right)}\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    16. Simplified1.5

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \left(\color{blue}{\left(-\left(2 \cdot \log \left(\sqrt[3]{x}\right)\right) \cdot x\right)} + \sqrt{x} \cdot \left(\sqrt{x} \cdot \left(-\log \left(\sqrt[3]{x}\right)\right)\right)\right)\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]
    17. Simplified1.5

      \[\leadsto \left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \left(\left(-\left(2 \cdot \log \left(\sqrt[3]{x}\right)\right) \cdot x\right) + \color{blue}{\left(-\log \left(\sqrt[3]{x}\right)\right) \cdot x}\right)\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}}\right) - x\]

    if 4.209233512697917e+50 < z

    1. Initial program 28.4

      \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.9189385332046700050057097541866824030876\right) + \frac{\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321\right) \cdot z + 0.08333333333333299564049667651488562114537}{x}\]
    2. Simplified28.4

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x - 0.5, \log x, 0.9189385332046700050057097541866824030876\right) + \frac{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}{x}\right) - x}\]
    3. Taylor expanded around inf 28.9

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{{z}^{2}}{x}, y, \mathsf{fma}\left(\frac{{z}^{2}}{x}, 7.936500793651000149400709382518925849581 \cdot 10^{-4}, \mathsf{fma}\left(\log x, x, -x\right)\right)\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification4.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.220890695010470087568016663424145810024 \cdot 10^{154}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - x \cdot \left(-\log x\right)\right) + \frac{1}{\mathsf{fma}\left(0.4000000000000064059868520871532382443547, x \cdot z, 12.00000000000004796163466380676254630089 \cdot x\right) - 0.1009522780952416126654114236771420110017 \cdot \left(x \cdot {z}^{2}\right)}\right) - x\\ \mathbf{elif}\;z \le 4.209233512697917048429572331592439435071 \cdot 10^{50}:\\ \;\;\;\;\left(\frac{1}{\frac{x}{\mathsf{fma}\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321, z, 0.08333333333333299564049667651488562114537\right)}} + \left(\mathsf{fma}\left(0.5, -\log x, 0.9189385332046700050057097541866824030876\right) - \left(-\left(\log \left(\sqrt[3]{x}\right) \cdot x + \left(2 \cdot \log \left(\sqrt[3]{x}\right)\right) \cdot x\right)\right)\right)\right) - x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{{z}^{2}}{x}, y, \mathsf{fma}\left(\frac{{z}^{2}}{x}, 7.936500793651000149400709382518925849581 \cdot 10^{-4}, \mathsf{fma}\left(\log x, x, -x\right)\right)\right)\\ \end{array}\]

Reproduce

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

  :herbie-target
  (+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467001 x)) (/ 0.0833333333333329956 x)) (* (/ z x) (- (* z (+ y 7.93650079365100015e-4)) 0.0027777777777778)))

  (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467001) (/ (+ (* (- (* (+ y 7.93650079365100015e-4) z) 0.0027777777777778) z) 0.0833333333333329956) x)))