MV How would this affect my usage of variables?

I'm currently making a type of simulator game for a school project but I just only realize a week ago that RPG MV doesn't use float but rather var data type. So, If anyone would like to help me advise on making a simple decimal display. (Percentage as well, hihihi ) It would be very much helpful

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();
}
};

while the other is this;

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

I tried using my variables and I observe that in value.toFixed(2) setting a choice that has a controlled variable like #0007 += 1 to choices that are correct they don't add up as 6 (assuming you've answered 6 questions correctly). It always goes 1.00111111. But in the original, the Math.floor(value); It displays 6 correct answers.

The thing is I really need to calculate for decimals and then turn it into percentages as well as display it properly but if the logic ain't matching up on the correct answers then my quiz game won't work well

P.S the attached image is just the concept on what the game my group is developing
As a tip, please post code inside the CODE tags (the </> on the edit bar). That preserves indentations and brackets, so your code is easier to read and more accurate.

setting a choice that has a controlled variable like #0007 += 1 to choices that are correct they don't add up as 6 (assuming you've answered 6 questions correctly). It always goes 1.00111111.
I think you misunderstand what toFixed() does - it returns a string.

So if you have a string of "1.00" then "1.00" + "1" is string concatenation, correctly resulting in "1.001" and so on.

I don't see any reason for you to be using toFixed() inside of the setValue() method. You could simply remove the line that calls Math.floor() then, when you're printing the variable in your event, apply toFixed() there.

Or you can skip trying to modify this function and set the values directly via the Script box in the Control Variables event command - entering a decimal there will store the decimal.

P.S the attached image is just the concept on what the game my group is developing
There are a few odd things in your code.

Why is there a $gameVariables.value(7) hanging out on the first line? That doesn't do anything.

Then it just reads strangely to keep going back and forth between the getters and the direct access of ._data. Using the included value() method will not alter the value you entered, so should be used for consistency.
See if this discussion helps.

Original thread: https://forums.rpgmakerweb.com/threads/how-would-this-affect-my-usage-of-variables.166788/