File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 */
66
77/**
8- * Round a value to a given decimal place.
8+ * Round a value to the given precision.
9+ *
10+ * For example:
11+ *
12+ * ```javascript
13+ * RoundTo(123.456, 0) = 123
14+ * RoundTo(123.456, 1) = 120
15+ * RoundTo(123.456, 2) = 100
16+ * ```
17+ *
18+ * To round the decimal, i.e. to round to precision, pass in a negative `place`:
19+ *
20+ * ```javascript
21+ * RoundTo(123.456789, 0) = 123
22+ * RoundTo(123.456789, -1) = 123.5
23+ * RoundTo(123.456789, -2) = 123.46
24+ * RoundTo(123.456789, -3) = 123.457
25+ * ```
926 *
1027 * @function Phaser.Math.RoundTo
1128 * @since 3.0.0
1229 *
1330 * @param {number } value - The value to round.
14- * @param {integer } [place=0] - The place to round to.
31+ * @param {integer } [place=0] - The place to round to. Positive to round the units, negative to round the decimal.
1532 * @param {integer } [base=10] - The base to round in. Default is 10 for decimal.
1633 *
1734 * @return {number } The rounded value.
You can’t perform that action at this time.
0 commit comments