<commit_before>'use strict';

// MODULES //

var isnan = require( '@stdlib/math/base/utils/is-nan' );
var expm1 = require( '@stdlib/math/base/special/expm1' );
var log1p = require( '@stdlib/math/base/special/log1p' );
var exp = require( '@stdlib/math/base/special/exp' );
var pow = require( '@stdlib/math/base/special/pow' );
var ln = require( '@stdlib/math/base/special/ln' );
var LNHALF = require( '@stdlib/math/constants/float64-ln-half' );
var NINF = require( '@stdlib/math/constants/float64-ninf' );
var nan = require( './nan.js' );


// FACTORY //

/**
* Returns a function for evaluating the logarithm of the cumulative distribution function (CDF) for a Weibull distribution.
*
* @param {PositiveNumber} lambda - shape parameter
* @param {PositiveNumber} k - scale parameter
* @returns {Function} logCDF
*
* @example
* var cdf = factory( 10.0, 2.0 );
* var y = cdf( 12.0 );
* // returns ~-0.27
* y = cdf( 8.0 );
* // returns ~-0.749
*/
function factory( lambda, k ) {
	if ( isnan( lambda ) || isnan( k ) ) {
		return nan;
	}
	if ( lambda <= 0.0 || k <= 0.0 ) {
		return nan;
	}
	/**
	* Evaluates the logarithm of the cumulative distribution function (CDF) for a Weibull distribution.
	*
	* @private
	* @param {number} x - input value
	* @returns {Probability} evaluated logCDF
	*
	* @example
	* var y = cdf( 2 );
	* // returns <number>
	*/
	return function cdf( x ) {
		var p;
		if ( isnan( x ) ) {
			return NaN;
		}
		if ( x < 0.0 ) {
			return NINF;
		}
		p = -pow( x / lambda, k );
		return p < LNHALF ? log1p( -exp( p ) ) : ln( -expm1( p ) );
	}; // end FUNCTION cdf()
} // end FUNCTION factory()


// EXPORTS //

module.exports = factory;<commit_msg>Fix function name<commit_after>'use strict';

// MODULES //

var isnan = require( '@stdlib/math/base/utils/is-nan' );
var expm1 = require( '@stdlib/math/base/special/expm1' );
var log1p = require( '@stdlib/math/base/special/log1p' );
var exp = require( '@stdlib/math/base/special/exp' );
var pow = require( '@stdlib/math/base/special/pow' );
var ln = require( '@stdlib/math/base/special/ln' );
var LNHALF = require( '@stdlib/math/constants/float64-ln-half' );
var NINF = require( '@stdlib/math/constants/float64-ninf' );
var nan = require( './nan.js' );


// FACTORY //

/**
* Returns a function for evaluating the logarithm of the cumulative distribution function (CDF) for a Weibull distribution.
*
* @param {PositiveNumber} lambda - shape parameter
* @param {PositiveNumber} k - scale parameter
* @returns {Function} logCDF
*
* @example
* var cdf = factory( 10.0, 2.0 );
* var y = cdf( 12.0 );
* // returns ~-0.27
* y = cdf( 8.0 );
* // returns ~-0.749
*/
function factory( lambda, k ) {
	if ( isnan( lambda ) || isnan( k ) ) {
		return nan;
	}
	if ( lambda <= 0.0 || k <= 0.0 ) {
		return nan;
	}
	/**
	* Evaluates the logarithm of the cumulative distribution function (CDF) for a Weibull distribution.
	*
	* @private
	* @param {number} x - input value
	* @returns {Probability} evaluated logCDF
	*
	* @example
	* var y = cdf( 2 );
	* // returns <number>
	*/
	return function logcdf( x ) {
		var p;
		if ( isnan( x ) ) {
			return NaN;
		}
		if ( x < 0.0 ) {
			return NINF;
		}
		p = -pow( x / lambda, k );
		return p < LNHALF ? log1p( -exp( p ) ) : ln( -expm1( p ) );
	}; // end FUNCTION logcdf()
} // end FUNCTION factory()


// EXPORTS //

module.exports = factory;
{'fraction_non_alphanumeric': 0.17446043165467626, 'fraction_numerical': 0.02038369304556355, 'mean_word_length': 3.035066505441354, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7060421', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1229, 'n_words': 349}