Average Error: 6.0 → 0.5
Time: 1.4m
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}\;x \le 2.255227432011573084151084780673526403278 \cdot 10^{46}:\\ \;\;\;\;\frac{\left(\left(z \cdot z\right) \cdot \left(7.936500793651000149400709382518925849581 \cdot 10^{-4} + y\right) - z \cdot 0.002777777777777800001512975569539776188321\right) + 0.08333333333333299564049667651488562114537}{x} + \left(0.9189385332046700050057097541866824030876 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z}{\frac{x}{z}} \cdot \left(7.936500793651000149400709382518925849581 \cdot 10^{-4} + y\right) - \frac{0.002777777777777800001512975569539776188321}{x} \cdot z\right) + \left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(0.9189385332046700050057097541866824030876 + \left(\left(x - 0.5\right) \cdot \log \left({x}^{\frac{1}{3}}\right) - 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}\;x \le 2.255227432011573084151084780673526403278 \cdot 10^{46}:\\
\;\;\;\;\frac{\left(\left(z \cdot z\right) \cdot \left(7.936500793651000149400709382518925849581 \cdot 10^{-4} + y\right) - z \cdot 0.002777777777777800001512975569539776188321\right) + 0.08333333333333299564049667651488562114537}{x} + \left(0.9189385332046700050057097541866824030876 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{\frac{x}{z}} \cdot \left(7.936500793651000149400709382518925849581 \cdot 10^{-4} + y\right) - \frac{0.002777777777777800001512975569539776188321}{x} \cdot z\right) + \left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(0.9189385332046700050057097541866824030876 + \left(\left(x - 0.5\right) \cdot \log \left({x}^{\frac{1}{3}}\right) - x\right)\right)\right)\\

\end{array}
double f(double x, double y, double z) {
        double r23841104 = x;
        double r23841105 = 0.5;
        double r23841106 = r23841104 - r23841105;
        double r23841107 = log(r23841104);
        double r23841108 = r23841106 * r23841107;
        double r23841109 = r23841108 - r23841104;
        double r23841110 = 0.91893853320467;
        double r23841111 = r23841109 + r23841110;
        double r23841112 = y;
        double r23841113 = 0.0007936500793651;
        double r23841114 = r23841112 + r23841113;
        double r23841115 = z;
        double r23841116 = r23841114 * r23841115;
        double r23841117 = 0.0027777777777778;
        double r23841118 = r23841116 - r23841117;
        double r23841119 = r23841118 * r23841115;
        double r23841120 = 0.083333333333333;
        double r23841121 = r23841119 + r23841120;
        double r23841122 = r23841121 / r23841104;
        double r23841123 = r23841111 + r23841122;
        return r23841123;
}

double f(double x, double y, double z) {
        double r23841124 = x;
        double r23841125 = 2.255227432011573e+46;
        bool r23841126 = r23841124 <= r23841125;
        double r23841127 = z;
        double r23841128 = r23841127 * r23841127;
        double r23841129 = 0.0007936500793651;
        double r23841130 = y;
        double r23841131 = r23841129 + r23841130;
        double r23841132 = r23841128 * r23841131;
        double r23841133 = 0.0027777777777778;
        double r23841134 = r23841127 * r23841133;
        double r23841135 = r23841132 - r23841134;
        double r23841136 = 0.083333333333333;
        double r23841137 = r23841135 + r23841136;
        double r23841138 = r23841137 / r23841124;
        double r23841139 = 0.91893853320467;
        double r23841140 = log(r23841124);
        double r23841141 = 0.5;
        double r23841142 = r23841124 - r23841141;
        double r23841143 = r23841140 * r23841142;
        double r23841144 = r23841143 - r23841124;
        double r23841145 = r23841139 + r23841144;
        double r23841146 = r23841138 + r23841145;
        double r23841147 = r23841124 / r23841127;
        double r23841148 = r23841127 / r23841147;
        double r23841149 = r23841148 * r23841131;
        double r23841150 = r23841133 / r23841124;
        double r23841151 = r23841150 * r23841127;
        double r23841152 = r23841149 - r23841151;
        double r23841153 = cbrt(r23841124);
        double r23841154 = r23841153 * r23841153;
        double r23841155 = log(r23841154);
        double r23841156 = r23841142 * r23841155;
        double r23841157 = 0.3333333333333333;
        double r23841158 = pow(r23841124, r23841157);
        double r23841159 = log(r23841158);
        double r23841160 = r23841142 * r23841159;
        double r23841161 = r23841160 - r23841124;
        double r23841162 = r23841139 + r23841161;
        double r23841163 = r23841156 + r23841162;
        double r23841164 = r23841152 + r23841163;
        double r23841165 = r23841126 ? r23841146 : r23841164;
        return r23841165;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.0
Target1.3
Herbie0.5
\[\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 2 regimes
  2. if x < 2.255227432011573e+46

    1. Initial program 0.5

      \[\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. Taylor expanded around 0 0.5

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

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

    if 2.255227432011573e+46 < x

    1. Initial program 11.3

      \[\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. Using strategy rm
    3. Applied add-cube-cbrt11.3

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} - 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}\]
    4. Applied log-prod11.4

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \color{blue}{\left(\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \log \left(\sqrt[3]{x}\right)\right)} - 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}\]
    5. Applied distribute-lft-in11.4

      \[\leadsto \left(\left(\color{blue}{\left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x}\right)\right)} - 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}\]
    6. Applied associate--l+11.3

      \[\leadsto \left(\color{blue}{\left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x}\right) - x\right)\right)} + 0.9189385332046700050057097541866824030876\right) + \frac{\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321\right) \cdot z + 0.08333333333333299564049667651488562114537}{x}\]
    7. Applied associate-+l+11.3

      \[\leadsto \color{blue}{\left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(\left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x}\right) - x\right) + 0.9189385332046700050057097541866824030876\right)\right)} + \frac{\left(\left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) \cdot z - 0.002777777777777800001512975569539776188321\right) \cdot z + 0.08333333333333299564049667651488562114537}{x}\]
    8. Using strategy rm
    9. Applied pow1/311.3

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

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

      \[\leadsto \left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(\left(\left(x - 0.5\right) \cdot \log \left({x}^{\frac{1}{3}}\right) - x\right) + 0.9189385332046700050057097541866824030876\right)\right) + \color{blue}{\left(\frac{z}{\frac{x}{z}} \cdot \left(y + 7.936500793651000149400709382518925849581 \cdot 10^{-4}\right) - \frac{0.002777777777777800001512975569539776188321}{x} \cdot z\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 2.255227432011573084151084780673526403278 \cdot 10^{46}:\\ \;\;\;\;\frac{\left(\left(z \cdot z\right) \cdot \left(7.936500793651000149400709382518925849581 \cdot 10^{-4} + y\right) - z \cdot 0.002777777777777800001512975569539776188321\right) + 0.08333333333333299564049667651488562114537}{x} + \left(0.9189385332046700050057097541866824030876 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z}{\frac{x}{z}} \cdot \left(7.936500793651000149400709382518925849581 \cdot 10^{-4} + y\right) - \frac{0.002777777777777800001512975569539776188321}{x} \cdot z\right) + \left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(0.9189385332046700050057097541866824030876 + \left(\left(x - 0.5\right) \cdot \log \left({x}^{\frac{1}{3}}\right) - x\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019200 
(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)))