Average Error: 26.7 → 0.8
Time: 7.3s
Precision: binary64
\[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -1.3509035285611866 \cdot 10^{+59} \lor \neg \left(x \leq 1.0135065295007165 \cdot 10^{+52}\right):\\ \;\;\;\;\left(x - 2\right) \cdot \left(4.16438922228 + \left(\frac{y}{{x}^{3}} - \frac{101.7851458539211}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - 2\right) \cdot \frac{\sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)} \cdot \left(x \cdot \left(\sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)} \cdot \sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)}\right)\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\\ \end{array}\]
\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}
\begin{array}{l}
\mathbf{if}\;x \leq -1.3509035285611866 \cdot 10^{+59} \lor \neg \left(x \leq 1.0135065295007165 \cdot 10^{+52}\right):\\
\;\;\;\;\left(x - 2\right) \cdot \left(4.16438922228 + \left(\frac{y}{{x}^{3}} - \frac{101.7851458539211}{x}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x - 2\right) \cdot \frac{\sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)} \cdot \left(x \cdot \left(\sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)} \cdot \sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)}\right)\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\\

\end{array}
(FPCore (x y z)
 :precision binary64
 (/
  (*
   (- 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)))
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.3509035285611866e+59) (not (<= x 1.0135065295007165e+52)))
   (*
    (- x 2.0)
    (+ 4.16438922228 (- (/ y (pow x 3.0)) (/ 101.7851458539211 x))))
   (*
    (- x 2.0)
    (/
     (+
      (*
       (cbrt
        (+
         y
         (* x (+ (* x (+ (* x 4.16438922228) 78.6994924154)) 137.519416416))))
       (*
        x
        (*
         (cbrt
          (+
           y
           (*
            x
            (+ (* x (+ (* x 4.16438922228) 78.6994924154)) 137.519416416))))
         (cbrt
          (+
           y
           (*
            x
            (+ (* x (+ (* x 4.16438922228) 78.6994924154)) 137.519416416)))))))
      z)
     (+
      (* x (+ (* x (+ (* x (+ x 43.3400022514)) 263.505074721)) 313.399215894))
      47.066876606)))))
double code(double x, double y, double z) {
	return (((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 tmp;
	if (((x <= -1.3509035285611866e+59) || !(x <= 1.0135065295007165e+52))) {
		tmp = ((double) (((double) (x - 2.0)) * ((double) (4.16438922228 + ((double) ((y / ((double) pow(x, 3.0))) - (101.7851458539211 / x)))))));
	} else {
		tmp = ((double) (((double) (x - 2.0)) * (((double) (((double) (((double) cbrt(((double) (y + ((double) (x * ((double) (((double) (x * ((double) (((double) (x * 4.16438922228)) + 78.6994924154)))) + 137.519416416)))))))) * ((double) (x * ((double) (((double) cbrt(((double) (y + ((double) (x * ((double) (((double) (x * ((double) (((double) (x * 4.16438922228)) + 78.6994924154)))) + 137.519416416)))))))) * ((double) cbrt(((double) (y + ((double) (x * ((double) (((double) (x * ((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 tmp;
}

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.7
Target0.6
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;x < -3.326128725870005 \cdot 10^{+62}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \mathbf{elif}\;x < 9.429991714554673 \cdot 10^{+55}:\\ \;\;\;\;\frac{x - 2}{1} \cdot \frac{\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z}{\left(\left(263.505074721 \cdot x + \left(43.3400022514 \cdot \left(x \cdot x\right) + x \cdot \left(x \cdot x\right)\right)\right) + 313.399215894\right) \cdot x + 47.066876606}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -1.3509035285611866e59 or 1.0135065295007165e52 < x

    1. Initial program Error: 63.1 bits

      \[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}\]
    2. SimplifiedError: 59.5 bits

      \[\leadsto \color{blue}{\left(x - 2\right) \cdot \frac{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}}\]
    3. Taylor expanded around inf Error: 0.4 bits

      \[\leadsto \left(x - 2\right) \cdot \color{blue}{\left(\left(\frac{y}{{x}^{3}} + 4.16438922228\right) - 101.7851458539211 \cdot \frac{1}{x}\right)}\]
    4. SimplifiedError: 0.4 bits

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

    if -1.3509035285611866e59 < x < 1.0135065295007165e52

    1. Initial program Error: 1.5 bits

      \[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}\]
    2. SimplifiedError: 0.7 bits

      \[\leadsto \color{blue}{\left(x - 2\right) \cdot \frac{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrtError: 1.1 bits

      \[\leadsto \left(x - 2\right) \cdot \frac{x \cdot \color{blue}{\left(\left(\sqrt[3]{x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y} \cdot \sqrt[3]{x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y}\right) \cdot \sqrt[3]{x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y}\right)} + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\]
    5. Applied associate-*r*Error: 1.1 bits

      \[\leadsto \left(x - 2\right) \cdot \frac{\color{blue}{\left(x \cdot \left(\sqrt[3]{x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y} \cdot \sqrt[3]{x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y}\right)\right) \cdot \sqrt[3]{x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y}} + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\]
  3. Recombined 2 regimes into one program.
  4. Final simplificationError: 0.8 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.3509035285611866 \cdot 10^{+59} \lor \neg \left(x \leq 1.0135065295007165 \cdot 10^{+52}\right):\\ \;\;\;\;\left(x - 2\right) \cdot \left(4.16438922228 + \left(\frac{y}{{x}^{3}} - \frac{101.7851458539211}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - 2\right) \cdot \frac{\sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)} \cdot \left(x \cdot \left(\sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)} \cdot \sqrt[3]{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)}\right)\right) + z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\\ \end{array}\]

Reproduce

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