to-fixed

1.0.1 • Public • Published

to-fixed

Convert a float into a fixed-point number containing x positive integers.

Build status

Install

$ npm install to-fixed

API

:number < fixed(number, digits)

Note that unlike Number.prototype.toFixed, this modules returns a number instead of a string.

Example

var fixed = require('to-fixed')
 
fixed(1.2345, 1)
> 1.2
 
fixed(0.0000123, 2)
> 0.000012

License

MIT

Package Sidebar

Install

npm i to-fixed

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • michaelrhodes