Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The maximum [safe][safe-integers] nth [double factorial][double-factorial] when
<!-- eslint-disable id-length -->

```javascript
var bool = ( FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL === 301 );
var bool = ( FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL === 300 );
// returns true
```

Expand All @@ -58,7 +58,7 @@ var bool = ( FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL === 301 );
```javascript
var FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float64/max-safe-nth-double-factorial' );

function factorial( n ) {
function factorial2( n ) {
var a;
var i;

Expand All @@ -72,7 +72,7 @@ function factorial( n ) {
var v;
var i;
for ( i = 0; i < 400; i++ ) {
v = factorial( i );
v = factorial2( i );
if ( i > FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL ) {
console.log( 'Unsafe: %d', v );
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Examples
--------
> {{alias}}
301
300

See Also
--------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @example
* var max = FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL;
* // returns 301
* // returns 300
*/
declare const FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL: number;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

var FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL = require( './../lib' ); // eslint-disable-line id-length

function factorial( n ) {
function factorial2( n ) {
var a;
var i;

Expand All @@ -34,7 +34,7 @@ function factorial( n ) {
var v;
var i;
for ( i = 0; i < 400; i++ ) {
v = factorial( i );
v = factorial2( i );
if ( i > FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL ) {
console.log( 'Unsafe: %d', v );
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
/**
* Macro for the maximum safe nth double factorial when stored in double-precision floating-point format.
*/
#define STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL 301
#define STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL 300

#endif // !STDLIB_CONSTANTS_FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL_H
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @example
* var FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float64/max-safe-nth-double-factorial' );
* // returns 301
* // returns 300
*/


Expand All @@ -37,11 +37,11 @@
*
* @constant
* @type {integer}
* @default 301
* @default 300
* @see [double factorial]{@link https://en.wikipedia.org/wiki/Double_factorial}
* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}
*/
var FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL = 301|0; // eslint-disable-line id-length
var FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL = 300|0; // eslint-disable-line id-length


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tape( 'main export is a number', function test( t ) {
t.end();
});

tape( 'the exported value is 301', function test( t ) {
t.strictEqual( FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL, 301, 'returns expected value' );
tape( 'the exported value is 300', function test( t ) {
t.strictEqual( FLOAT64_MAX_SAFE_NTH_DOUBLE_FACTORIAL, 300, 'returns expected value' );
t.end();
});