# math for dummies - I mean, for Weidu

## Recommended Posts

How does Weidu have fractions? Say I want to edit the XP value field in .cre files with something like this pseudocode:

```COPY_EXISTING_REGEXP GLOB ~*.cre~ ~override~
SET new_xp = (xp / 5)
PATCH_IF xp > 5 BEGIN
WRITE_LONG 0x00xx new_xp
END
BUT_ONLY```
What happens if "new_xp" resolves to 12.5?

Anyways, the weidu will write the number 12.5 to be 12. Even if it were 12.992... it still is 12.

I have this plenty with the Frankenstein that is the iispell mod function that I haven't released yet.

Also it should be remembered that the divisional remainder, though not shown in the whole number quotient is always factored in.. so you can easily get surprised by 2+2 = 5... as it could be 2(.3) + 2(.9) = 5(.2) if you don't take this into account.

Sweet. As long as it doesn't cause crashes.

To be clear, it's the integer division operation using / that returns only the whole number quotient. You can use the modulo operator % to determine the remainder of the division, if desired.

For example, 7 / 2 is 3 and 7 % 2 is 1. (7 divided by 2 is 3 with a remainder of 1.) You probably did long division with remainders in elementary school.

A handy thing to know is that X % 2 will tell you if X is an odd number: odd numbers will leave a remainder of 1, while even numbers will leave a remainder of 0.

Euclidean division

Modulo Operator

exccelent name for my next ESO char

best for imperial templar but argonian nightblade healer will do pretty nicely too