Average Error: 27.1 → 0.6
Time: 48.5s
Precision: 64
\[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922227999963610045597306452691555 + 78.69949241540000173245061887428164482117\right) \cdot x + 137.5194164160000127594685181975364685059\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514000013984514225739985704422\right) \cdot x + 263.5050747210000281484099105000495910645\right) \cdot x + 313.3992158940000081202015280723571777344\right) \cdot x + 47.06687660600000100430406746454536914825}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.441930889845368224166212569091687399724 \cdot 10^{61} \lor \neg \left(x \le 2.123566528240809367630637301063751523391 \cdot 10^{49}\right):\\ \;\;\;\;\left(4.16438922227999963610045597306452691555 \cdot x - 110.1139242984810948655649553984403610229\right) + \frac{\frac{y}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(x - 2\right) \cdot \frac{z + \left(x \cdot \left(x \cdot \left(4.16438922227999963610045597306452691555 \cdot x + 78.69949241540000173245061887428164482117\right) + 137.5194164160000127594685181975364685059\right) + y\right) \cdot x}{x \cdot \left(\left(x \cdot \left(43.3400022514000013984514225739985704422 + x\right) + 263.5050747210000281484099105000495910645\right) \cdot x + 313.3992158940000081202015280723571777344\right) + 47.06687660600000100430406746454536914825}\\ \end{array}\]
\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922227999963610045597306452691555 + 78.69949241540000173245061887428164482117\right) \cdot x + 137.5194164160000127594685181975364685059\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514000013984514225739985704422\right) \cdot x + 263.5050747210000281484099105000495910645\right) \cdot x + 313.3992158940000081202015280723571777344\right) \cdot x + 47.06687660600000100430406746454536914825}
\begin{array}{l}
\mathbf{if}\;x \le -3.441930889845368224166212569091687399724 \cdot 10^{61} \lor \neg \left(x \le 2.123566528240809367630637301063751523391 \cdot 10^{49}\right):\\
\;\;\;\;\left(4.16438922227999963610045597306452691555 \cdot x - 110.1139242984810948655649553984403610229\right) + \frac{\frac{y}{x}}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(x - 2\right) \cdot \frac{z + \left(x \cdot \left(x \cdot \left(4.16438922227999963610045597306452691555 \cdot x + 78.69949241540000173245061887428164482117\right) + 137.5194164160000127594685181975364685059\right) + y\right) \cdot x}{x \cdot \left(\left(x \cdot \left(43.3400022514000013984514225739985704422 + x\right) + 263.5050747210000281484099105000495910645\right) \cdot x + 313.3992158940000081202015280723571777344\right) + 47.06687660600000100430406746454536914825}\\

\end{array}
double f(double x, double y, double z) {
        double r382313 = x;
        double r382314 = 2.0;
        double r382315 = r382313 - r382314;
        double r382316 = 4.16438922228;
        double r382317 = r382313 * r382316;
        double r382318 = 78.6994924154;
        double r382319 = r382317 + r382318;
        double r382320 = r382319 * r382313;
        double r382321 = 137.519416416;
        double r382322 = r382320 + r382321;
        double r382323 = r382322 * r382313;
        double r382324 = y;
        double r382325 = r382323 + r382324;
        double r382326 = r382325 * r382313;
        double r382327 = z;
        double r382328 = r382326 + r382327;
        double r382329 = r382315 * r382328;
        double r382330 = 43.3400022514;
        double r382331 = r382313 + r382330;
        double r382332 = r382331 * r382313;
        double r382333 = 263.505074721;
        double r382334 = r382332 + r382333;
        double r382335 = r382334 * r382313;
        double r382336 = 313.399215894;
        double r382337 = r382335 + r382336;
        double r382338 = r382337 * r382313;
        double r382339 = 47.066876606;
        double r382340 = r382338 + r382339;
        double r382341 = r382329 / r382340;
        return r382341;
}

double f(double x, double y, double z) {
        double r382342 = x;
        double r382343 = -3.441930889845368e+61;
        bool r382344 = r382342 <= r382343;
        double r382345 = 2.1235665282408094e+49;
        bool r382346 = r382342 <= r382345;
        double r382347 = !r382346;
        bool r382348 = r382344 || r382347;
        double r382349 = 4.16438922228;
        double r382350 = r382349 * r382342;
        double r382351 = 110.1139242984811;
        double r382352 = r382350 - r382351;
        double r382353 = y;
        double r382354 = r382353 / r382342;
        double r382355 = r382354 / r382342;
        double r382356 = r382352 + r382355;
        double r382357 = 2.0;
        double r382358 = r382342 - r382357;
        double r382359 = z;
        double r382360 = 78.6994924154;
        double r382361 = r382350 + r382360;
        double r382362 = r382342 * r382361;
        double r382363 = 137.519416416;
        double r382364 = r382362 + r382363;
        double r382365 = r382342 * r382364;
        double r382366 = r382365 + r382353;
        double r382367 = r382366 * r382342;
        double r382368 = r382359 + r382367;
        double r382369 = 43.3400022514;
        double r382370 = r382369 + r382342;
        double r382371 = r382342 * r382370;
        double r382372 = 263.505074721;
        double r382373 = r382371 + r382372;
        double r382374 = r382373 * r382342;
        double r382375 = 313.399215894;
        double r382376 = r382374 + r382375;
        double r382377 = r382342 * r382376;
        double r382378 = 47.066876606;
        double r382379 = r382377 + r382378;
        double r382380 = r382368 / r382379;
        double r382381 = r382358 * r382380;
        double r382382 = r382348 ? r382356 : r382381;
        return r382382;
}

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

Original27.1
Target0.5
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;x \lt -3.326128725870004842699683658678411714981 \cdot 10^{62}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922227999963610045597306452691555 \cdot x\right) - 110.1139242984810948655649553984403610229\\ \mathbf{elif}\;x \lt 9.429991714554672672712552870340896976735 \cdot 10^{55}:\\ \;\;\;\;\frac{x - 2}{1} \cdot \frac{\left(\left(\left(x \cdot 4.16438922227999963610045597306452691555 + 78.69949241540000173245061887428164482117\right) \cdot x + 137.5194164160000127594685181975364685059\right) \cdot x + y\right) \cdot x + z}{\left(\left(263.5050747210000281484099105000495910645 \cdot x + \left(43.3400022514000013984514225739985704422 \cdot \left(x \cdot x\right) + x \cdot \left(x \cdot x\right)\right)\right) + 313.3992158940000081202015280723571777344\right) \cdot x + 47.06687660600000100430406746454536914825}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922227999963610045597306452691555 \cdot x\right) - 110.1139242984810948655649553984403610229\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -3.441930889845368e+61 or 2.1235665282408094e+49 < x

    1. Initial program 62.8

      \[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922227999963610045597306452691555 + 78.69949241540000173245061887428164482117\right) \cdot x + 137.5194164160000127594685181975364685059\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514000013984514225739985704422\right) \cdot x + 263.5050747210000281484099105000495910645\right) \cdot x + 313.3992158940000081202015280723571777344\right) \cdot x + 47.06687660600000100430406746454536914825}\]
    2. Simplified59.1

      \[\leadsto \color{blue}{\frac{x - 2}{x \cdot \left(313.3992158940000081202015280723571777344 + \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right) \cdot x\right) + 47.06687660600000100430406746454536914825} \cdot \left(\left(y + \left(x \cdot \left(78.69949241540000173245061887428164482117 + 4.16438922227999963610045597306452691555 \cdot x\right) + 137.5194164160000127594685181975364685059\right) \cdot x\right) \cdot x + z\right)}\]
    3. Taylor expanded around inf 0.4

      \[\leadsto \color{blue}{\left(\frac{y}{{x}^{2}} + 4.16438922227999963610045597306452691555 \cdot x\right) - 110.1139242984810948655649553984403610229}\]
    4. Simplified0.4

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

    if -3.441930889845368e+61 < x < 2.1235665282408094e+49

    1. Initial program 1.4

      \[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922227999963610045597306452691555 + 78.69949241540000173245061887428164482117\right) \cdot x + 137.5194164160000127594685181975364685059\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514000013984514225739985704422\right) \cdot x + 263.5050747210000281484099105000495910645\right) \cdot x + 313.3992158940000081202015280723571777344\right) \cdot x + 47.06687660600000100430406746454536914825}\]
    2. Simplified1.0

      \[\leadsto \color{blue}{\frac{x - 2}{x \cdot \left(313.3992158940000081202015280723571777344 + \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right) \cdot x\right) + 47.06687660600000100430406746454536914825} \cdot \left(\left(y + \left(x \cdot \left(78.69949241540000173245061887428164482117 + 4.16438922227999963610045597306452691555 \cdot x\right) + 137.5194164160000127594685181975364685059\right) \cdot x\right) \cdot x + z\right)}\]
    3. Using strategy rm
    4. Applied div-inv1.0

      \[\leadsto \color{blue}{\left(\left(x - 2\right) \cdot \frac{1}{x \cdot \left(313.3992158940000081202015280723571777344 + \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right) \cdot x\right) + 47.06687660600000100430406746454536914825}\right)} \cdot \left(\left(y + \left(x \cdot \left(78.69949241540000173245061887428164482117 + 4.16438922227999963610045597306452691555 \cdot x\right) + 137.5194164160000127594685181975364685059\right) \cdot x\right) \cdot x + z\right)\]
    5. Applied associate-*l*1.0

      \[\leadsto \color{blue}{\left(x - 2\right) \cdot \left(\frac{1}{x \cdot \left(313.3992158940000081202015280723571777344 + \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right) \cdot x\right) + 47.06687660600000100430406746454536914825} \cdot \left(\left(y + \left(x \cdot \left(78.69949241540000173245061887428164482117 + 4.16438922227999963610045597306452691555 \cdot x\right) + 137.5194164160000127594685181975364685059\right) \cdot x\right) \cdot x + z\right)\right)}\]
    6. Simplified0.7

      \[\leadsto \left(x - 2\right) \cdot \color{blue}{\frac{\left(\left(\left(4.16438922227999963610045597306452691555 \cdot x + 78.69949241540000173245061887428164482117\right) \cdot x + 137.5194164160000127594685181975364685059\right) \cdot x + y\right) \cdot x + z}{47.06687660600000100430406746454536914825 + \left(313.3992158940000081202015280723571777344 + \left(\left(43.3400022514000013984514225739985704422 + x\right) \cdot x + 263.5050747210000281484099105000495910645\right) \cdot x\right) \cdot x}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -3.441930889845368224166212569091687399724 \cdot 10^{61} \lor \neg \left(x \le 2.123566528240809367630637301063751523391 \cdot 10^{49}\right):\\ \;\;\;\;\left(4.16438922227999963610045597306452691555 \cdot x - 110.1139242984810948655649553984403610229\right) + \frac{\frac{y}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(x - 2\right) \cdot \frac{z + \left(x \cdot \left(x \cdot \left(4.16438922227999963610045597306452691555 \cdot x + 78.69949241540000173245061887428164482117\right) + 137.5194164160000127594685181975364685059\right) + y\right) \cdot x}{x \cdot \left(\left(x \cdot \left(43.3400022514000013984514225739985704422 + x\right) + 263.5050747210000281484099105000495910645\right) \cdot x + 313.3992158940000081202015280723571777344\right) + 47.06687660600000100430406746454536914825}\\ \end{array}\]

Reproduce

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