Package Exports
- @writetome51/get-fixed-float
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@writetome51/get-fixed-float) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
getFixedFloat(
number,
numDigitsAfterDecimal
): string
Returns number with a decimal and exact numDigitsAfterDecimal.
If number already has more than numDigitsAfterDecimal, it will be
rounded to the last required digit after the decimal.
The algorithm prevents cumulative rounding errors.
Examples
getFixedFloat(101.975, 3); // --> '101.975'
getFixedFloat(-10.7754, 1); // --> '-10.8'
getFixedFloat(101.965, 2); // --> '101.96'
getFixedFloat(101.975, 2); // --> '101.98'
getFixedFloat(9, 2); // --> '9.00'
getFixedFloat(-100.9754, 5)); // --> '-100.97540'
getFixedFloat(10.9754, 1); // --> '11.0'Installation
npm i @writetome51/get-fixed-float
Loading
import {getFixedFloat} from '@writetome51/get-fixed-float';