Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@stdlib/math-base-special-factorial
Advanced tools
Factorial function.
The factorial function may be defined as the product
or according to the recurrence relation
Following the convention for an empty product, in all definitions,
The Gamma function extends the factorial function for non-integer values.
The factorial of a negative integer is not defined.
npm install @stdlib/math-base-special-factorial
var factorial = require( '@stdlib/math-base-special-factorial' );
Evaluates the factorial function.
var v = factorial( 3.0 );
// returns 6.0
v = factorial( -1.5 );
// returns ~-3.545
v = factorial( -0.5 );
// returns ~1.772
v = factorial( 0.5 );
// returns ~0.886
v = factorial( -10.0 );
// returns NaN
v = factorial( 171.0 );
// returns Infinity
v = factorial( NaN );
// returns NaN
var incrspace = require( '@stdlib/array-base-incrspace' );
var factorial = require( '@stdlib/math-base-special-factorial' );
var x = incrspace( -10.0, 100.0, 1.0 );
var i;
for ( i = 0; i < x.length; i++ ) {
console.log( 'x: %d, f(x): %d', x[ i ], factorial( x[ i ] ) );
}
@stdlib/math/base/special/factorialln
: evaluate the natural logarithm of the factorial function.This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2022. The Stdlib Authors.
FAQs
Evaluate a factorial.
We found that @stdlib/math-base-special-factorial demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.