Average Error: 26.4 → 0.8
Time: 6.9s
Precision: binary64
\[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922227999964 + 78.6994924154000017\right) \cdot x + 137.51941641600001\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514000014\right) \cdot x + 263.50507472100003\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606000001}\]
\[\begin{array}{l} \mathbf{if}\;x \le -14279306773394.69 \lor \neg \left(x \le 6.16648922728830492 \cdot 10^{51}\right):\\ \;\;\;\;\left(x - 2\right) \cdot \left(4.16438922227999964 + \left(\frac{y}{{x}^{3}} - \frac{101.785145853921094}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - 2\right) \cdot \frac{x \cdot \left(y + x \cdot \left(\frac{{x}^{3} \cdot \left(4.16438922227999964 \cdot 4.16438922227999964\right) - x \cdot \left(78.6994924154000017 \cdot 78.6994924154000017\right)}{x \cdot 4.16438922227999964 - 78.6994924154000017} + 137.51941641600001\right)\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514000014\right) + 263.50507472100003\right) + 313.399215894\right) + 47.066876606000001}\\ \end{array}\]
\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922227999964 + 78.6994924154000017\right) \cdot x + 137.51941641600001\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514000014\right) \cdot x + 263.50507472100003\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606000001}
\begin{array}{l}
\mathbf{if}\;x \le -14279306773394.69 \lor \neg \left(x \le 6.16648922728830492 \cdot 10^{51}\right):\\
\;\;\;\;\left(x - 2\right) \cdot \left(4.16438922227999964 + \left(\frac{y}{{x}^{3}} - \frac{101.785145853921094}{x}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x - 2\right) \cdot \frac{x \cdot \left(y + x \cdot \left(\frac{{x}^{3} \cdot \left(4.16438922227999964 \cdot 4.16438922227999964\right) - x \cdot \left(78.6994924154000017 \cdot 78.6994924154000017\right)}{x \cdot 4.16438922227999964 - 78.6994924154000017} + 137.51941641600001\right)\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514000014\right) + 263.50507472100003\right) + 313.399215894\right) + 47.066876606000001}\\

\end{array}
double code(double x, double y, double z) {
	return ((double) (((double) (((double) (x - 2.0)) * ((double) (((double) (((double) (((double) (((double) (((double) (((double) (((double) (x * 4.16438922228)) + 78.6994924154)) * x)) + 137.519416416)) * x)) + y)) * x)) + z)))) / ((double) (((double) (((double) (((double) (((double) (((double) (((double) (x + 43.3400022514)) * x)) + 263.505074721)) * x)) + 313.399215894)) * x)) + 47.066876606))));
}
double code(double x, double y, double z) {
	double VAR;
	if (((x <= -14279306773394.688) || !(x <= 6.166489227288305e+51))) {
		VAR = ((double) (((double) (x - 2.0)) * ((double) (4.16438922228 + ((double) (((double) (y / ((double) pow(x, 3.0)))) - ((double) (101.7851458539211 / x))))))));
	} else {
		VAR = ((double) (((double) (x - 2.0)) * ((double) (((double) (((double) (x * ((double) (y + ((double) (x * ((double) (((double) (((double) (((double) (((double) pow(x, 3.0)) * ((double) (4.16438922228 * 4.16438922228)))) - ((double) (x * ((double) (78.6994924154 * 78.6994924154)))))) / ((double) (((double) (x * 4.16438922228)) - 78.6994924154)))) + 137.519416416)))))))) + z)) / ((double) (((double) (x * ((double) (((double) (x * ((double) (((double) (x * ((double) (x + 43.3400022514)))) + 263.505074721)))) + 313.399215894)))) + 47.066876606))))));
	}
	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

Original26.4
Target0.5
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;x \lt -3.3261287258700048 \cdot 10^{62}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922227999964 \cdot x\right) - 110.11392429848109\\ \mathbf{elif}\;x \lt 9.4299917145546727 \cdot 10^{55}:\\ \;\;\;\;\frac{x - 2}{1} \cdot \frac{\left(\left(\left(x \cdot 4.16438922227999964 + 78.6994924154000017\right) \cdot x + 137.51941641600001\right) \cdot x + y\right) \cdot x + z}{\left(\left(263.50507472100003 \cdot x + \left(43.3400022514000014 \cdot \left(x \cdot x\right) + x \cdot \left(x \cdot x\right)\right)\right) + 313.399215894\right) \cdot x + 47.066876606000001}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922227999964 \cdot x\right) - 110.11392429848109\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -14279306773394.69 or 6.16648922728830492e51 < x

    1. Initial program 58.6

      \[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922227999964 + 78.6994924154000017\right) \cdot x + 137.51941641600001\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514000014\right) \cdot x + 263.50507472100003\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606000001}\]
    2. Simplified54.8

      \[\leadsto \color{blue}{\left(x - 2\right) \cdot \frac{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922227999964 + 78.6994924154000017\right) + 137.51941641600001\right) + y\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514000014\right) + 263.50507472100003\right) + 313.399215894\right) + 47.066876606000001}}\]
    3. Taylor expanded around inf 1.5

      \[\leadsto \left(x - 2\right) \cdot \color{blue}{\left(\left(\frac{y}{{x}^{3}} + 4.16438922227999964\right) - 101.785145853921094 \cdot \frac{1}{x}\right)}\]
    4. Simplified1.5

      \[\leadsto \left(x - 2\right) \cdot \color{blue}{\left(4.16438922227999964 + \left(\frac{y}{{x}^{3}} - \frac{101.785145853921094}{x}\right)\right)}\]

    if -14279306773394.69 < x < 6.16648922728830492e51

    1. Initial program 0.8

      \[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922227999964 + 78.6994924154000017\right) \cdot x + 137.51941641600001\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514000014\right) \cdot x + 263.50507472100003\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606000001}\]
    2. Simplified0.3

      \[\leadsto \color{blue}{\left(x - 2\right) \cdot \frac{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922227999964 + 78.6994924154000017\right) + 137.51941641600001\right) + y\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514000014\right) + 263.50507472100003\right) + 313.399215894\right) + 47.066876606000001}}\]
    3. Using strategy rm
    4. Applied flip-+0.3

      \[\leadsto \left(x - 2\right) \cdot \frac{x \cdot \left(x \cdot \left(x \cdot \color{blue}{\frac{\left(x \cdot 4.16438922227999964\right) \cdot \left(x \cdot 4.16438922227999964\right) - 78.6994924154000017 \cdot 78.6994924154000017}{x \cdot 4.16438922227999964 - 78.6994924154000017}} + 137.51941641600001\right) + y\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514000014\right) + 263.50507472100003\right) + 313.399215894\right) + 47.066876606000001}\]
    5. Applied associate-*r/0.3

      \[\leadsto \left(x - 2\right) \cdot \frac{x \cdot \left(x \cdot \left(\color{blue}{\frac{x \cdot \left(\left(x \cdot 4.16438922227999964\right) \cdot \left(x \cdot 4.16438922227999964\right) - 78.6994924154000017 \cdot 78.6994924154000017\right)}{x \cdot 4.16438922227999964 - 78.6994924154000017}} + 137.51941641600001\right) + y\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514000014\right) + 263.50507472100003\right) + 313.399215894\right) + 47.066876606000001}\]
    6. Simplified0.3

      \[\leadsto \left(x - 2\right) \cdot \frac{x \cdot \left(x \cdot \left(\frac{\color{blue}{{x}^{3} \cdot \left(4.16438922227999964 \cdot 4.16438922227999964\right) - x \cdot \left(78.6994924154000017 \cdot 78.6994924154000017\right)}}{x \cdot 4.16438922227999964 - 78.6994924154000017} + 137.51941641600001\right) + y\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514000014\right) + 263.50507472100003\right) + 313.399215894\right) + 47.066876606000001}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -14279306773394.69 \lor \neg \left(x \le 6.16648922728830492 \cdot 10^{51}\right):\\ \;\;\;\;\left(x - 2\right) \cdot \left(4.16438922227999964 + \left(\frac{y}{{x}^{3}} - \frac{101.785145853921094}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - 2\right) \cdot \frac{x \cdot \left(y + x \cdot \left(\frac{{x}^{3} \cdot \left(4.16438922227999964 \cdot 4.16438922227999964\right) - x \cdot \left(78.6994924154000017 \cdot 78.6994924154000017\right)}{x \cdot 4.16438922227999964 - 78.6994924154000017} + 137.51941641600001\right)\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514000014\right) + 263.50507472100003\right) + 313.399215894\right) + 47.066876606000001}\\ \end{array}\]

Reproduce

herbie shell --seed 2020185 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, C"
  :precision binary64

  :herbie-target
  (if (< x -3.326128725870005e+62) (- (+ (/ y (* x x)) (* 4.16438922228 x)) 110.1139242984811) (if (< x 9.429991714554673e+55) (* (/ (- x 2.0) 1.0) (/ (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z) (+ (* (+ (+ (* 263.505074721 x) (+ (* 43.3400022514 (* x x)) (* x (* x x)))) 313.399215894) x) 47.066876606))) (- (+ (/ y (* x x)) (* 4.16438922228 x)) 110.1139242984811)))

  (/ (* (- x 2.0) (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z)) (+ (* (+ (* (+ (* (+ x 43.3400022514) x) 263.505074721) x) 313.399215894) x) 47.066876606)))