Average Error: 6.1 → 0.4
Time: 5.5s
Precision: binary64
\[\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 9338607.11884063669:\\ \;\;\;\;\left(\sqrt{\log x \cdot \left(x - 0.5\right) - x} \cdot \sqrt{\log x \cdot \left(x - 0.5\right) - x} + 0.91893853320467001\right) + \frac{z \cdot \left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) + 0.0833333333333329956}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\log x \cdot \left(x - 0.5\right) - x\right) + 0.91893853320467001\right) + \left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot \frac{z}{\frac{x}{z}} - 0.0027777777777778 \cdot \frac{z}{x}\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 9338607.11884063669:\\
\;\;\;\;\left(\sqrt{\log x \cdot \left(x - 0.5\right) - x} \cdot \sqrt{\log x \cdot \left(x - 0.5\right) - x} + 0.91893853320467001\right) + \frac{z \cdot \left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) + 0.0833333333333329956}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\log x \cdot \left(x - 0.5\right) - x\right) + 0.91893853320467001\right) + \left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot \frac{z}{\frac{x}{z}} - 0.0027777777777778 \cdot \frac{z}{x}\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 <= 9338607.118840637)) {
		VAR = ((double) (((double) (((double) (((double) sqrt(((double) (((double) (((double) log(x)) * ((double) (x - 0.5)))) - x)))) * ((double) sqrt(((double) (((double) (((double) log(x)) * ((double) (x - 0.5)))) - x)))))) + 0.91893853320467)) + ((double) (((double) (((double) (z * ((double) (((double) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)))) + 0.083333333333333)) / x))));
	} else {
		VAR = ((double) (((double) (((double) (((double) (((double) log(x)) * ((double) (x - 0.5)))) - x)) + 0.91893853320467)) + ((double) (((double) (((double) (y + 0.0007936500793651)) * ((double) (z / ((double) (x / z)))))) - ((double) (0.0027777777777778 * ((double) (z / 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.1
Target1.2
Herbie0.4
\[\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 < 9338607.11884063669

    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. Using strategy rm
    3. Applied add-sqr-sqrt0.4

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

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

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

    if 9338607.11884063669 < x

    1. Initial program 10.4

      \[\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. Taylor expanded around inf 10.5

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \color{blue}{\left(\left(7.93650079365100015 \cdot 10^{-4} \cdot \frac{{z}^{2}}{x} + \frac{{z}^{2} \cdot y}{x}\right) - 0.0027777777777778 \cdot \frac{z}{x}\right)}\]
    3. Simplified0.4

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \color{blue}{\left(\frac{z}{\frac{x}{z}} \cdot \left(y + 7.93650079365100015 \cdot 10^{-4}\right) - 0.0027777777777778 \cdot \frac{z}{x}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 9338607.11884063669:\\ \;\;\;\;\left(\sqrt{\log x \cdot \left(x - 0.5\right) - x} \cdot \sqrt{\log x \cdot \left(x - 0.5\right) - x} + 0.91893853320467001\right) + \frac{z \cdot \left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) + 0.0833333333333329956}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\log x \cdot \left(x - 0.5\right) - x\right) + 0.91893853320467001\right) + \left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot \frac{z}{\frac{x}{z}} - 0.0027777777777778 \cdot \frac{z}{x}\right)\\ \end{array}\]

Reproduce

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