This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* largestRemainderRound will round each number in an array to the nearest | |
* integer but make sure that the the sum of all the numbers still equals | |
* desiredTotal. Uses Largest Remainder Method. Returns numbers in order they | |
* came. | |
* | |
* @param {number[]} numbers - array of numbers | |
* @param {number} desiredTotal - denominator: 100 for %, 360 for deg | |
* @return {number[]} the list of rounded numbers | |
* @example |