For example I want 1%3 to return the value 33
What if I only want to go to the 100th decimal point using %?
Learning Ruby and RGSSxWhy should 1 % 3 return 33?
Maybe you mean
1 / 3 = 0.33333
If converted to percent it will become 33.33333 %
But you want it become 33 instead?
1 / 3 = 0.33333
If converted to percent it will become 33.33333 %
But you want it become 33 instead?
% is the modulo operator (in most programming languages), so 1 % 3 will always return 1 (or 2 % 3 will always return 2, or 4 % 3 will always return 1, to give a few more examples of the modulo operation)
What operation do you want to perfom?
If you wish the division (/) to return a percentage instead of a 0.333, then the correct mathematical would be something like X = ((1/3)*100).to_i
(haven't checked the syntax)
Please tell us what you want, and pleas keep in mind that you cannot redefine operators that are already in use by RGSS - the maximum possible is defining new operators or functions.
Original thread: https://forums.rpgmakerweb.com/threads/what-if-i-only-want-to-go-to-the-100th-decimal-point-using.16350/