0.1.0 • Published 12 months ago

@stdlib/constants-float64-max-safe-nth-factorial v0.1.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 months ago

FLOAT64_MAX_SAFE_NTH_FACTORIAL

NPM version Build Status Coverage Status

Maximum safe nth factorial when stored in double-precision floating-point format.

Installation

npm install @stdlib/constants-float64-max-safe-nth-factorial

Usage

var FLOAT64_MAX_SAFE_NTH_FACTORIAL = require( '@stdlib/constants-float64-max-safe-nth-factorial' );

FLOAT64_MAX_SAFE_NTH_FACTORIAL

The maximum safe nth factorial when stored in double-precision floating-point format.

var bool = ( FLOAT64_MAX_SAFE_NTH_FACTORIAL === 170 );
// returns true

Examples

var FLOAT64_MAX_SAFE_NTH_FACTORIAL = require( '@stdlib/constants-float64-max-safe-nth-factorial' );

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

    a = 1;
    for ( i = 2; i <= n; i++ ) {
        a *= i;
    }
    return a;
}

for ( i = 0; i < 200; i++ ) {
    v = factorial( i );
    if ( i > FLOAT64_MAX_SAFE_NTH_FACTORIAL ) {
        console.log( 'Unsafe: %d', v );
    } else {
        console.log( 'Safe:   %d', v );
    }
}

C APIs

Usage

#include "stdlib/constants/float64/max_safe_nth_factorial.h"

STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL

Macro for the maximum safe nth factorial when stored in double-precision floating-point format.


Notice

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.

Community

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2024. The Stdlib Authors.