Average Error: 6.0 → 4.0
Time: 7.3s
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}\]
\[\begin{array}{l} \mathbf{if}\;x \le 564945614527036:\\ \;\;\;\;\mathsf{fma}\left(\log x, x - 0.5, \left(\frac{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}{x} - \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{x}\right)\right), -0.91893853320467001 \cdot 1\right)\right) - \mathsf{fma}\left(-0.91893853320467001, 1, 0.91893853320467001 \cdot 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{{z}^{2}}{x}, y, 7.93650079365100015 \cdot 10^{-4} \cdot \frac{{z}^{2}}{x} - \mathsf{fma}\left(\log \left(\frac{1}{x}\right), x, x\right)\right)\\ \end{array}\]
\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}
\begin{array}{l}
\mathbf{if}\;x \le 564945614527036:\\
\;\;\;\;\mathsf{fma}\left(\log x, x - 0.5, \left(\frac{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}{x} - \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{x}\right)\right), -0.91893853320467001 \cdot 1\right)\right) - \mathsf{fma}\left(-0.91893853320467001, 1, 0.91893853320467001 \cdot 1\right)\right)\\

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

\end{array}
double code(double x, double y, double z) {
	return ((double) (((double) (((double) (((double) (((double) (x - 0.5)) * ((double) log(x)))) - x)) + 0.91893853320467)) + ((double) (((double) (((double) (((double) (((double) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)) * z)) + 0.083333333333333)) / x))));
}
double code(double x, double y, double z) {
	double VAR;
	if ((x <= 564945614527036.0)) {
		VAR = ((double) fma(((double) log(x)), ((double) (x - 0.5)), ((double) (((double) (((double) (((double) fma(((double) (((double) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)), z, 0.083333333333333)) / x)) - ((double) fma(((double) (((double) cbrt(x)) * ((double) cbrt(x)))), ((double) expm1(((double) log1p(((double) cbrt(x)))))), ((double) -(((double) (0.91893853320467 * 1.0)))))))) - ((double) fma(((double) -(0.91893853320467)), 1.0, ((double) (0.91893853320467 * 1.0))))))));
	} else {
		VAR = ((double) fma(((double) (((double) pow(z, 2.0)) / x)), y, ((double) (((double) (0.0007936500793651 * ((double) (((double) pow(z, 2.0)) / x)))) - ((double) fma(((double) log(((double) (1.0 / x)))), x, x))))));
	}
	return VAR;
}

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.2
Herbie4.0
\[\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. Split input into 2 regimes
  2. if x < 564945614527036.0

    1. Initial program 0.1

      \[\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. Simplified0.1

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

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

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

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

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

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

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

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

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

    if 564945614527036.0 < x

    1. Initial program 10.5

      \[\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. Simplified10.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log x, x - 0.5, \frac{\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956}{x} - \left(x - 0.91893853320467001\right)\right)}\]
    3. Taylor expanded around inf 10.6

      \[\leadsto \color{blue}{\left(7.93650079365100015 \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. Simplified7.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 564945614527036:\\ \;\;\;\;\mathsf{fma}\left(\log x, x - 0.5, \left(\frac{\mathsf{fma}\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778, z, 0.0833333333333329956\right)}{x} - \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{x}\right)\right), -0.91893853320467001 \cdot 1\right)\right) - \mathsf{fma}\left(-0.91893853320467001, 1, 0.91893853320467001 \cdot 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{{z}^{2}}{x}, y, 7.93650079365100015 \cdot 10^{-4} \cdot \frac{{z}^{2}}{x} - \mathsf{fma}\left(\log \left(\frac{1}{x}\right), x, x\right)\right)\\ \end{array}\]

Reproduce

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