FLOAT32_MAX_SAFE_NTH_FACTORIAL

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

Usage

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

FLOAT32_MAX_SAFE_NTH_FACTORIAL

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

var bool = ( FLOAT32_MAX_SAFE_NTH_FACTORIAL === 34 );
// returns true

Examples

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

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

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

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

C APIs

Usage

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

STDLIB_CONSTANT_FLOAT32_MAX_SAFE_NTH_FACTORIAL

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

Did you find this page helpful?