'use strict';

// FUNCTIONS //

var ln = require( '@stdlib/math/base/special/ln' );
var isnan = require( '@stdlib/math/base/utils/is-nan' );


// QUANTILE //

/**
* Evaluates the quantile function for a logistic distribution with location parameter `mu` and scale parameter `s` at a probability `p`.
*
* @param {Probability} p - input value
* @param {number} mu - location parameter
* @param {NonNegativeNumber} s - scale parameter
* @returns {number} evaluated quantile function
*
* @example
* var y = quantile( 0.8, 0.0, 1.0 );
* // returns ~1.386
* @example
* var y = quantile( 0.5, 4.0, 2.0 );
* // returns 4
* @example
* var y = quantile( 1.1, 0.0, 1.0 );
* // returns NaN
* @example
* var y = quantile( -0.2, 0.0, 1.0 );
* // returns NaN
* @example
* var y = quantile( NaN, 0.0, 1.0 );
* // returns NaN
* @example
* var y = quantile( 0.0, NaN, 1.0 );
* // returns NaN
* @example
* var y = quantile( 0.0, 0.0, NaN );
* // returns NaN
* @example
* // Negative scale parameter:
* var y = quantile( 0.5, 0.0, -1.0 );
* // returns NaN
*/
function quantile( p, mu, s ) {
	if ( isnan( p ) || p < 0.0 || p > 1.0 ) {
		return NaN;
	}
	if ( s < 0.0 ) {
		return NaN;
	}
	if ( s === 0.0 ) {
		return mu;
	}
	return mu + s * ln( p / ( 1.0 - p ) );
} // end FUNCTION quantile()


// EXPORTS //

module.exports = quantile;

@@ -29,17 +29,20 @@
 //%0A%0Avar 
-l
+isna
 n = requ
@@ -69,17 +69,19 @@
 ase/
-special/l
+utils/is-na
 n' )
@@ -82,28 +82,25 @@
 nan' );%0Avar 
-isna
+l
 n = require(
@@ -115,35 +115,33 @@
 b/math/base/
-utils/is-na
+special/l
 n' );%0A%0A%0A// Q
@@ -1073,74 +1073,110 @@
 if (
- 
+%0A%09%09
 isnan( 
-p
+mu
  ) %7C%7C
- p %3C 0.0 %7C%7C p %3E 1.0 ) %7B%0A%09%09return NaN;%0A%09%7D%0A%09if ( s %3C 0
+%0A%09%09isnan( s ) %7C%7C%0A%09%09s %3C 0.0%0A%09) %7B%0A%09%09return NaN;%0A%09%7D%0A%09if ( isnan( p ) %7C%7C p %3C 0.0 %7C%7C p %3E 1
 .0 )

Add argument checks