Average Error: 25.3 → 1.0
Time: 37.9s
Precision: 64
\[\frac{\left(x - 2.0\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 \le -9.11443811172362 \cdot 10^{+24}:\\ \;\;\;\;\left(4.16438922228 \cdot x - 110.1139242984811\right) + \frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \le 7.359401364217448 \cdot 10^{+22}:\\ \;\;\;\;\frac{\left(x - 2.0\right) \cdot \left(x \cdot \left(\left(137.519416416 \cdot x + \left(\left(4.16438922228 \cdot x\right) \cdot \left(x \cdot x\right) + \left(x \cdot x\right) \cdot 78.6994924154\right)\right) + y\right) + z\right)}{47.066876606 + \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(43.3400022514 + x\right)\right)\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(4.16438922228 \cdot x - 110.1139242984811\right) + \frac{\frac{y}{x}}{x}\\ \end{array}\]
\frac{\left(x - 2.0\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 \le -9.11443811172362 \cdot 10^{+24}:\\
\;\;\;\;\left(4.16438922228 \cdot x - 110.1139242984811\right) + \frac{\frac{y}{x}}{x}\\

\mathbf{elif}\;x \le 7.359401364217448 \cdot 10^{+22}:\\
\;\;\;\;\frac{\left(x - 2.0\right) \cdot \left(x \cdot \left(\left(137.519416416 \cdot x + \left(\left(4.16438922228 \cdot x\right) \cdot \left(x \cdot x\right) + \left(x \cdot x\right) \cdot 78.6994924154\right)\right) + y\right) + z\right)}{47.066876606 + \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(43.3400022514 + x\right)\right)\right) \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\left(4.16438922228 \cdot x - 110.1139242984811\right) + \frac{\frac{y}{x}}{x}\\

\end{array}
double f(double x, double y, double z) {
        double r18204337 = x;
        double r18204338 = 2.0;
        double r18204339 = r18204337 - r18204338;
        double r18204340 = 4.16438922228;
        double r18204341 = r18204337 * r18204340;
        double r18204342 = 78.6994924154;
        double r18204343 = r18204341 + r18204342;
        double r18204344 = r18204343 * r18204337;
        double r18204345 = 137.519416416;
        double r18204346 = r18204344 + r18204345;
        double r18204347 = r18204346 * r18204337;
        double r18204348 = y;
        double r18204349 = r18204347 + r18204348;
        double r18204350 = r18204349 * r18204337;
        double r18204351 = z;
        double r18204352 = r18204350 + r18204351;
        double r18204353 = r18204339 * r18204352;
        double r18204354 = 43.3400022514;
        double r18204355 = r18204337 + r18204354;
        double r18204356 = r18204355 * r18204337;
        double r18204357 = 263.505074721;
        double r18204358 = r18204356 + r18204357;
        double r18204359 = r18204358 * r18204337;
        double r18204360 = 313.399215894;
        double r18204361 = r18204359 + r18204360;
        double r18204362 = r18204361 * r18204337;
        double r18204363 = 47.066876606;
        double r18204364 = r18204362 + r18204363;
        double r18204365 = r18204353 / r18204364;
        return r18204365;
}

double f(double x, double y, double z) {
        double r18204366 = x;
        double r18204367 = -9.11443811172362e+24;
        bool r18204368 = r18204366 <= r18204367;
        double r18204369 = 4.16438922228;
        double r18204370 = r18204369 * r18204366;
        double r18204371 = 110.1139242984811;
        double r18204372 = r18204370 - r18204371;
        double r18204373 = y;
        double r18204374 = r18204373 / r18204366;
        double r18204375 = r18204374 / r18204366;
        double r18204376 = r18204372 + r18204375;
        double r18204377 = 7.359401364217448e+22;
        bool r18204378 = r18204366 <= r18204377;
        double r18204379 = 2.0;
        double r18204380 = r18204366 - r18204379;
        double r18204381 = 137.519416416;
        double r18204382 = r18204381 * r18204366;
        double r18204383 = r18204366 * r18204366;
        double r18204384 = r18204370 * r18204383;
        double r18204385 = 78.6994924154;
        double r18204386 = r18204383 * r18204385;
        double r18204387 = r18204384 + r18204386;
        double r18204388 = r18204382 + r18204387;
        double r18204389 = r18204388 + r18204373;
        double r18204390 = r18204366 * r18204389;
        double r18204391 = z;
        double r18204392 = r18204390 + r18204391;
        double r18204393 = r18204380 * r18204392;
        double r18204394 = 47.066876606;
        double r18204395 = 313.399215894;
        double r18204396 = 263.505074721;
        double r18204397 = 43.3400022514;
        double r18204398 = r18204397 + r18204366;
        double r18204399 = r18204366 * r18204398;
        double r18204400 = r18204396 + r18204399;
        double r18204401 = r18204366 * r18204400;
        double r18204402 = r18204395 + r18204401;
        double r18204403 = r18204402 * r18204366;
        double r18204404 = r18204394 + r18204403;
        double r18204405 = r18204393 / r18204404;
        double r18204406 = r18204378 ? r18204405 : r18204376;
        double r18204407 = r18204368 ? r18204376 : r18204406;
        return r18204407;
}

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

Original25.3
Target0.5
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;x \lt -3.326128725870005 \cdot 10^{+62}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \mathbf{elif}\;x \lt 9.429991714554673 \cdot 10^{+55}:\\ \;\;\;\;\frac{x - 2.0}{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 < -9.11443811172362e+24 or 7.359401364217448e+22 < x

    1. Initial program 55.1

      \[\frac{\left(x - 2.0\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. Taylor expanded around inf 1.7

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

      \[\leadsto \color{blue}{\left(4.16438922228 \cdot x - 110.1139242984811\right) + \frac{\frac{y}{x}}{x}}\]

    if -9.11443811172362e+24 < x < 7.359401364217448e+22

    1. Initial program 0.4

      \[\frac{\left(x - 2.0\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. Taylor expanded around 0 0.4

      \[\leadsto \frac{\left(x - 2.0\right) \cdot \left(\left(\color{blue}{\left(137.519416416 \cdot x + \left(4.16438922228 \cdot {x}^{3} + 78.6994924154 \cdot {x}^{2}\right)\right)} + 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}\]
    3. Simplified0.4

      \[\leadsto \frac{\left(x - 2.0\right) \cdot \left(\left(\color{blue}{\left(137.519416416 \cdot x + \left(78.6994924154 \cdot \left(x \cdot x\right) + \left(x \cdot x\right) \cdot \left(x \cdot 4.16438922228\right)\right)\right)} + 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}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.11443811172362 \cdot 10^{+24}:\\ \;\;\;\;\left(4.16438922228 \cdot x - 110.1139242984811\right) + \frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \le 7.359401364217448 \cdot 10^{+22}:\\ \;\;\;\;\frac{\left(x - 2.0\right) \cdot \left(x \cdot \left(\left(137.519416416 \cdot x + \left(\left(4.16438922228 \cdot x\right) \cdot \left(x \cdot x\right) + \left(x \cdot x\right) \cdot 78.6994924154\right)\right) + y\right) + z\right)}{47.066876606 + \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(43.3400022514 + x\right)\right)\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(4.16438922228 \cdot x - 110.1139242984811\right) + \frac{\frac{y}{x}}{x}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< x -3.326128725870005e+62) (- (+ (/ y (* x x)) (* 4.16438922228 x)) 110.1139242984811) (if (< x 9.429991714554673e+55) (* (/ (- x 2.0) 1) (/ (+ (* (+ (* (+ (* (+ (* 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)))