Average Error: 26.9 → 1.3
Time: 24.8s
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 -63074748513986640340139900928 \lor \neg \left(x \le 620615997107907.625\right):\\ \;\;\;\;\left(4.16438922227999963610045597306452691555 \cdot x - 110.1139242984810948655649553984403610229\right) + \frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - 2\right) \cdot \left(z + x \cdot \left(y + x \cdot \left(x \cdot \left(4.16438922227999963610045597306452691555 \cdot x + 78.69949241540000173245061887428164482117\right) + 137.5194164160000127594685181975364685059\right)\right)\right)}{\sqrt{\left(313.3992158940000081202015280723571777344 + x \cdot \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right)\right) \cdot x + 47.06687660600000100430406746454536914825} \cdot \sqrt{\left(313.3992158940000081202015280723571777344 + x \cdot \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right)\right) \cdot x + 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 -63074748513986640340139900928 \lor \neg \left(x \le 620615997107907.625\right):\\
\;\;\;\;\left(4.16438922227999963610045597306452691555 \cdot x - 110.1139242984810948655649553984403610229\right) + \frac{y}{x \cdot x}\\

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

\end{array}
double f(double x, double y, double z) {
        double r354351 = x;
        double r354352 = 2.0;
        double r354353 = r354351 - r354352;
        double r354354 = 4.16438922228;
        double r354355 = r354351 * r354354;
        double r354356 = 78.6994924154;
        double r354357 = r354355 + r354356;
        double r354358 = r354357 * r354351;
        double r354359 = 137.519416416;
        double r354360 = r354358 + r354359;
        double r354361 = r354360 * r354351;
        double r354362 = y;
        double r354363 = r354361 + r354362;
        double r354364 = r354363 * r354351;
        double r354365 = z;
        double r354366 = r354364 + r354365;
        double r354367 = r354353 * r354366;
        double r354368 = 43.3400022514;
        double r354369 = r354351 + r354368;
        double r354370 = r354369 * r354351;
        double r354371 = 263.505074721;
        double r354372 = r354370 + r354371;
        double r354373 = r354372 * r354351;
        double r354374 = 313.399215894;
        double r354375 = r354373 + r354374;
        double r354376 = r354375 * r354351;
        double r354377 = 47.066876606;
        double r354378 = r354376 + r354377;
        double r354379 = r354367 / r354378;
        return r354379;
}

double f(double x, double y, double z) {
        double r354380 = x;
        double r354381 = -6.307474851398664e+28;
        bool r354382 = r354380 <= r354381;
        double r354383 = 620615997107907.6;
        bool r354384 = r354380 <= r354383;
        double r354385 = !r354384;
        bool r354386 = r354382 || r354385;
        double r354387 = 4.16438922228;
        double r354388 = r354387 * r354380;
        double r354389 = 110.1139242984811;
        double r354390 = r354388 - r354389;
        double r354391 = y;
        double r354392 = r354380 * r354380;
        double r354393 = r354391 / r354392;
        double r354394 = r354390 + r354393;
        double r354395 = 2.0;
        double r354396 = r354380 - r354395;
        double r354397 = z;
        double r354398 = 78.6994924154;
        double r354399 = r354388 + r354398;
        double r354400 = r354380 * r354399;
        double r354401 = 137.519416416;
        double r354402 = r354400 + r354401;
        double r354403 = r354380 * r354402;
        double r354404 = r354391 + r354403;
        double r354405 = r354380 * r354404;
        double r354406 = r354397 + r354405;
        double r354407 = r354396 * r354406;
        double r354408 = 313.399215894;
        double r354409 = 263.505074721;
        double r354410 = 43.3400022514;
        double r354411 = r354410 + r354380;
        double r354412 = r354380 * r354411;
        double r354413 = r354409 + r354412;
        double r354414 = r354380 * r354413;
        double r354415 = r354408 + r354414;
        double r354416 = r354415 * r354380;
        double r354417 = 47.066876606;
        double r354418 = r354416 + r354417;
        double r354419 = sqrt(r354418);
        double r354420 = r354419 * r354419;
        double r354421 = r354407 / r354420;
        double r354422 = r354386 ? r354394 : r354421;
        return r354422;
}

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.9
Target0.6
Herbie1.3
\[\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 < -6.307474851398664e+28 or 620615997107907.6 < x

    1. Initial program 56.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. Simplified53.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 2.1

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

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

    if -6.307474851398664e+28 < x < 620615997107907.6

    1. Initial program 0.5

      \[\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. Simplified0.6

      \[\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 add-sqr-sqrt0.9

      \[\leadsto \frac{x - 2}{\color{blue}{\sqrt{x \cdot \left(313.3992158940000081202015280723571777344 + \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right) \cdot x\right) + 47.06687660600000100430406746454536914825} \cdot \sqrt{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)\]
    5. Applied *-un-lft-identity0.9

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x - 2\right)}}{\sqrt{x \cdot \left(313.3992158940000081202015280723571777344 + \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right) \cdot x\right) + 47.06687660600000100430406746454536914825} \cdot \sqrt{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)\]
    6. Applied times-frac0.9

      \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{x \cdot \left(313.3992158940000081202015280723571777344 + \left(263.5050747210000281484099105000495910645 + x \cdot \left(43.3400022514000013984514225739985704422 + x\right)\right) \cdot x\right) + 47.06687660600000100430406746454536914825}} \cdot \frac{x - 2}{\sqrt{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)\]
    7. Simplified0.9

      \[\leadsto \left(\color{blue}{\frac{1}{\sqrt{47.06687660600000100430406746454536914825 + x \cdot \left(313.3992158940000081202015280723571777344 + x \cdot \left(x \cdot \left(x + 43.3400022514000013984514225739985704422\right) + 263.5050747210000281484099105000495910645\right)\right)}}} \cdot \frac{x - 2}{\sqrt{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)\]
    8. Simplified0.9

      \[\leadsto \left(\frac{1}{\sqrt{47.06687660600000100430406746454536914825 + x \cdot \left(313.3992158940000081202015280723571777344 + x \cdot \left(x \cdot \left(x + 43.3400022514000013984514225739985704422\right) + 263.5050747210000281484099105000495910645\right)\right)}} \cdot \color{blue}{\frac{x - 2}{\sqrt{47.06687660600000100430406746454536914825 + x \cdot \left(313.3992158940000081202015280723571777344 + x \cdot \left(x \cdot \left(x + 43.3400022514000013984514225739985704422\right) + 263.5050747210000281484099105000495910645\right)\right)}}}\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)\]
    9. Using strategy rm
    10. Applied frac-times0.9

      \[\leadsto \color{blue}{\frac{1 \cdot \left(x - 2\right)}{\sqrt{47.06687660600000100430406746454536914825 + x \cdot \left(313.3992158940000081202015280723571777344 + x \cdot \left(x \cdot \left(x + 43.3400022514000013984514225739985704422\right) + 263.5050747210000281484099105000495910645\right)\right)} \cdot \sqrt{47.06687660600000100430406746454536914825 + x \cdot \left(313.3992158940000081202015280723571777344 + x \cdot \left(x \cdot \left(x + 43.3400022514000013984514225739985704422\right) + 263.5050747210000281484099105000495910645\right)\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)\]
    11. Applied associate-*l/0.7

      \[\leadsto \color{blue}{\frac{\left(1 \cdot \left(x - 2\right)\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)}{\sqrt{47.06687660600000100430406746454536914825 + x \cdot \left(313.3992158940000081202015280723571777344 + x \cdot \left(x \cdot \left(x + 43.3400022514000013984514225739985704422\right) + 263.5050747210000281484099105000495910645\right)\right)} \cdot \sqrt{47.06687660600000100430406746454536914825 + x \cdot \left(313.3992158940000081202015280723571777344 + x \cdot \left(x \cdot \left(x + 43.3400022514000013984514225739985704422\right) + 263.5050747210000281484099105000495910645\right)\right)}}}\]
    12. Simplified0.7

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

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

Reproduce

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