mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 16:22:56 +02:00
[refactor] Moved 'roundToTwo' to its own TS file
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* 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`);
|
||||
}
|
||||
Reference in New Issue
Block a user