mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 14:13:48 +01:00
10 lines
262 B
TypeScript
10 lines
262 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(parseInt(`${decimal}e+2`, 10));
|
|
|
|
return +(`${leftShift}e-2`);
|
|
}
|