Changing numbers into whole numbers.

Recently, I ran into a big of an issue involving a plugin. I was informed that this actually has nothing to do with the plugin and is a more general RPG Maker thing, so that's why I'm here.

The issue is that, when displaying data such as the users ATK value (a.atk), there are some situations where it'll display as a number with a decimal point, such as 20.4, or in more extreme cases I've noticed, 20.33333333333336 or something of that variation. This is problematic because I display this information to the player and when it has decimal points, it clutters things up with arguably useless information.

I'm trying to figure out what I'd change and where I'd change it to convert these to whole numbers only, so that it would never be a case of the users value being 20.4, but just 20.

Further clarifying, this typically happens when I do formulas such as a.atk * 1.2 and then display the result.
If this is happening with formulas you're putting in yourself you can round the numbers appropriately using the below functions:

Code:
Math.round(a.atk * 1.2) // Will round normally
Math.floor(a.atk * 1.2) // Will round down
Math.ceil(a.atk * 1.2) // Will round up
If this is happening with formulas you're putting in yourself you can round the numbers appropriately using the below functions:

Code:
Math.round(a.atk * 1.2) // Will round normally
Math.floor(a.atk * 1.2) // Will round down
Math.ceil(a.atk * 1.2) // Will round up

This fixes it. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/changing-numbers-into-whole-numbers.113260/