$gameVariables.add truncates numbers. Why?

Game_Variables.prototype.setValue = function(variableId, value) {
if (variableId > 0 && variableId < $dataSystem.variables.length) {
if (typeof value === 'number') {
value = Math.floor(value);
}
this._data[variableId] = value;
this.onChange();
}
};


As stated, using $gameVariables.add truncates any number put into it. Is there any particular reason? This comes up from someone else asking how they can use a floating point number with a variable and assigning it with a bit of script did not work (obviously).


I have to say, I really really dislike truncation. If there's some reason it absolutely needs to be an integer, I feel like it should be rounding, at least. But that's the real question - is an integer really needed? Is there some strange thing that would break if it didn't get an integer or something? Seems like a strange choice to me.
$gameVariables.add?  Or $gameVariables.setValue?


It's just the way it's been in all the makers - variables are integers.


To get around it, just set it directly and call the onChange function (which causes the map to refresh in case any events are conditioned by the variable):

Code:
$gameVariables._data[id] = 12.9;
$gameVariables.onChange();
SetValue is probably what I was thinking. I was so in need of coffee this morning that I forgot I hadn't had coffee this morning, if that helps set my frame of mind.


Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/gamevariables-add-truncates-numbers-why.70580/