Average Error: 27.1 → 0.6
Time: 48.2s
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 r361643 = x;
        double r361644 = 2.0;
        double r361645 = r361643 - r361644;
        double r361646 = 4.16438922228;
        double r361647 = r361643 * r361646;
        double r361648 = 78.6994924154;
        double r361649 = r361647 + r361648;
        double r361650 = r361649 * r361643;
        double r361651 = 137.519416416;
        double r361652 = r361650 + r361651;
        double r361653 = r361652 * r361643;
        double r361654 = y;
        double r361655 = r361653 + r361654;
        double r361656 = r361655 * r361643;
        double r361657 = z;
        double r361658 = r361656 + r361657;
        double r361659 = r361645 * r361658;
        double r361660 = 43.3400022514;
        double r361661 = r361643 + r361660;
        double r361662 = r361661 * r361643;
        double r361663 = 263.505074721;
        double r361664 = r361662 + r361663;
        double r361665 = r361664 * r361643;
        double r361666 = 313.399215894;
        double r361667 = r361665 + r361666;
        double r361668 = r361667 * r361643;
        double r361669 = 47.066876606;
        double r361670 = r361668 + r361669;
        double r361671 = r361659 / r361670;
        return r361671;
}

double f(double x, double y, double z) {
        double r361672 = x;
        double r361673 = -3.441930889845368e+61;
        bool r361674 = r361672 <= r361673;
        double r361675 = 2.1235665282408094e+49;
        bool r361676 = r361672 <= r361675;
        double r361677 = !r361676;
        bool r361678 = r361674 || r361677;
        double r361679 = 4.16438922228;
        double r361680 = r361679 * r361672;
        double r361681 = 110.1139242984811;
        double r361682 = r361680 - r361681;
        double r361683 = y;
        double r361684 = r361683 / r361672;
        double r361685 = r361684 / r361672;
        double r361686 = r361682 + r361685;
        double r361687 = 2.0;
        double r361688 = r361672 - r361687;
        double r361689 = z;
        double r361690 = 78.6994924154;
        double r361691 = r361680 + r361690;
        double r361692 = r361672 * r361691;
        double r361693 = 137.519416416;
        double r361694 = r361692 + r361693;
        double r361695 = r361672 * r361694;
        double r361696 = r361695 + r361683;
        double r361697 = r361696 * r361672;
        double r361698 = r361689 + r361697;
        double r361699 = 43.3400022514;
        double r361700 = r361699 + r361672;
        double r361701 = r361672 * r361700;
        double r361702 = 263.505074721;
        double r361703 = r361701 + r361702;
        double r361704 = r361703 * r361672;
        double r361705 = 313.399215894;
        double r361706 = r361704 + r361705;
        double r361707 = r361672 * r361706;
        double r361708 = 47.066876606;
        double r361709 = r361707 + r361708;
        double r361710 = r361698 / r361709;
        double r361711 = r361688 * r361710;
        double r361712 = r361678 ? r361686 : r361711;
        return r361712;
}

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)))