'use strict';

// MODULES //

var gammaln = require( 'math-gammaln' );


// BETALN //

/**
* FUNCTION: betaln( x, y )
*	Evaluates the natural logarithm of the beta function of two numeric values.
*
* @param {Number} x - input value
* @param {Number} y - second input value
* @returns {Number} function value
*/
function betaln( x , y  ) {
	if ( x < 0 || y < 0 ) {
		return NaN;
	}
	if ( x === 0 || y === 0 ) {
		return Number.POSITIVE_INFINITY;
	}
	return gammaln( x ) + gammaln( y ) - gammaln( x + y );
} // end FUNCTION betaln()


// EXPORTS //

module.exports = betaln;

@@ -64,16 +64,60 @@
 aln' );%0A
+var PINF = require( 'const-pinf-float32' );%0A
 %0A%0A// BET
@@ -376,16 +376,121 @@
  y  ) %7B%0A
+%09// Special cases: NaN%0A%09if ( x !== x %7C%7C y !== y ) %7B%0A%09%09return NaN;%0A%09%7D%0A%09// Special cases: negative numbers%0A
 %09if ( x 
@@ -523,16 +523,37 @@
 NaN;%0A%09%7D%0A
+%09// Special cases: 0%0A
 %09if ( x 
@@ -586,32 +586,12 @@
 urn 
-Number.POSITIVE_INFINITY
+PINF
 ;%0A%09%7D

Update implementation