What happens if you use the %REM(n : 0)? modulo anything by 0 is always undefined right? I have a RPG program that is doing %REM(14 : 0) and returning a 2??? why is that? On some languages it's undefined or it returns the 14, since dividing by zero is undefined and everything is left over. Anyone??
Announcement
Collapse
No announcement yet.
%rem with zero
Collapse
X
-
It's also possible that the currently executing line is somewhere else in the program. So, even if the source matches the compiled object, the debug values might not be relevant to line 75. No way for us to know from what we can see.Tom
There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
Comment
-
About 01 vs 1, if you're thinking about octal values, RPG doesn't consider a number starting with zero to be an octal number. RPG only deals in decimal numbers. So 023 is twenty-three, the same as 23.
For those not familiar with octal numbers in C or Java, if you start a number with a zero in C or Java (probably other languages too), the number is considered to be octal, base 8. So for example, 023 in C or Java is octal, so it means 2*8 + 3*1 = nineteen.
- Likes 1
Comment
-
Originally posted by Barbara Morris View PostFor those not familiar with octal numbers in C or Java, if you start a number with a zero in C or Java (probably other languages too), the number is considered to be octal, base 8. So for example, 023 in C or Java is octal, so it means 2*8 + 3*1 = nineteen.
But I am reminded of a joke. Why do programmers always mix up Halloween and Christmas?
For the answer, click here: https://www.idtech.com/blog/part-i-t...he-rest-of-us/
- Likes 1
Comment
Comment