Skip to content

Latest commit

 

History

History
116 lines (68 loc) · 2.51 KB

File metadata and controls

116 lines (68 loc) · 2.51 KB

number2json

Return a JSON representation of a number.

Usage

var number2json = require( '@stdlib/number/float16/to-json' );

number2json( x )

Returns a JSON representation of a number.

var json = number2json( NaN );
/* returns
    {
        'type': 'float16',
        'value': 'NaN'
    }
*/

json = number2json( 3.14 );
// returns 3.140625

Examples

var number2json = require( '@stdlib/number/float16/to-json' );

console.log( number2json( NaN ) );