Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A single line function to modify MOD for better pattern recognition....
#5
Yes, I posted to Steve in the other thread he had a bit more work to do. I took a different approach form ours and his, Steve's original function, and used SGN() to make up for the differences. Basically the difference in positive to negative numbers is the positive uses the largest number that can be divided into the given number while a negative number uses that result - 1.

7 mod 5 as...

7 = (5 * 1) + 2 where 5 goes into 7 a max of 1 time. [7 mod 5 = 2]

-7 = (5 * -2) + 3 where 5 goes into -7 a max of -1 time and subtract 1 = -2. [-7 mod 5] = 3

Personally I'm going to use these as pattern functions going forward. In the past I used to adjust for zero for everything positive and I probably did something completely different if I came across negative numbers. @bplus Your circle demo was great!

Pete
Reply


Messages In This Thread
RE: A single line function to modify MOD for better pattern recognition.... - by Pete - 11-29-2022, 12:53 AM



Users browsing this thread: 3 Guest(s)