Maximum nth double factorial when stored in half-precision floating-point format.
var FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float16/max-nth-double-factorial' );The maximum nth double factorial when stored in half-precision floating-point format.
var bool = ( FLOAT16_MAX_NTH_DOUBLE_FACTORIAL === 12 );
// returns truevar FLOAT16_MAX_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float16/max-nth-double-factorial' );
function factorial2( n ) {
var a;
var i;
a = 1;
for ( i = n; i >= 2; i -= 2 ) {
a *= i;
}
return a;
}
var v;
var i;
for ( i = 0; i < 100; i++ ) {
v = factorial2( i );
if ( i > FLOAT16_MAX_NTH_DOUBLE_FACTORIAL ) {
console.log( 'Overflow: %d', v );
} else {
console.log( 'Valid: %d', v );
}
}#include "stdlib/constants/float16/max_nth_double_factorial.h"Macro for the maximum nth double factorial when stored in half-precision floating-point format.