mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
9 lines
259 B
TypeScript
9 lines
259 B
TypeScript
/**
|
|
* Rounds a number to two decimal places.
|
|
* @param decimal A decimal value to trim to two places.
|
|
*/
|
|
export function roundToTwo(decimal: number) {
|
|
const leftShift: number = Math.round(parseFloat(`${decimal}e+2`));
|
|
return +(`${leftShift}e-2`);
|
|
}
|