The remainder of the division

How can I calculate the remainder of the division?
I have a number 1.5, but I need to convert it to 5.

I want to get pair of numbers using float type. I can use an array, but to use a float number is simpler, especially in an array with other integer numbers.

For example, I have an array of numbers:
Array(1, 2, 4.1, 2, 1.8);

If I use inner array:
Array(1, 2, Array(4, 1), 2, Array(1, 8));
but it very large and I can get “Large script error” in Workshop

UPDATE:
Omg. I found the answer. MODULO, but it is the wrong way. It returns the floating part of the number - 0.5. I could get 5 using cast like (int) 0.5 but how can I do this in Workshop?

I made a converter:
variables
{
player:
125: BotCurrentDistanceToTarget
}

actions
{
Event Player.BotCurrentDistanceToTarget = Event Player.BotCurrentDistanceToTarget % 1 * 10;
While(Event Player.BotCurrentDistanceToTarget % 1 > 0.010 && Event Player.BotCurrentDistanceToTarget % 1 < 0.990);
Event Player.BotCurrentDistanceToTarget *= 10;
End;
}

I still don’t get why you need to convert a floating point number into an integer, using the remainder doesn’t work, therefore modulo won’t do the trick especially when you want a specific result out of it, its a scrubble, puzzle and guesser due modulo has no inverse operation since there would be no clue from what 1.5 or 5 could resolve from or to by a modulo. A conversation to a different data type is also not a mathematically or arithemtically defined process, and when you convert a floating point to an integer it will round/truncate depending on the digits behind the dot either up and down,(in computing there are other operations invovled like near zero rounding (Epsilon function)) to get it quite right in your example 1.5 or 1,5 will be converted or cast to the integer of 2. To do what you may want is to get the 5 after the dot and return it as an integer right? Well for that we need to cast the whole number into string, chop the 1 and the dot of so 5 is left and then lexically convert the string with 5 to a number, but thats a string related method not a modulo related one. Lastly, that is unfortunately not possible within the workshop.

3 Likes