question: public static double pdf ( double x , double k , double theta , double shift ) { if ( x <= shift || x == Double . POSITIVE_INFINITY ) { return 0. ; } x = ( x - shift ) * theta ; final double ex = Math . exp ( x ) ; return ex < Double . POSITIVE_INFINITY ? Math . exp ( k * x - ex - GammaDistribution . logGamma ( k ) ) * theta : 0. ; }
target:  ExpGamma distribution PDF (with 0.0 for x &lt; 0)