User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18

Thread: Quick Question about "Mod" operator

  1. #1
    No Products Registered

    Join Date
    Jan 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick Question about "Mod" operator

    I've been searching through the forums and the help file that came with MMF2, but none can tell what the "Mod" operator does in the expression editor to different numbers, they only point out that it is there. I've never used it but can someone tell what it does to numbers and why it is included?

    Thanks, Hughster

  2. #2
    No Products Registered

    Join Date
    Jul 2006
    Location
    Umeå, Sweden
    Posts
    1,090
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    http://en.wikipedia.org/wiki/Modulo_operation

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    It basically divides two numbers and returns the remainder.

  4. #4
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    Its especially useful when dealing with 2 or more dimensions.

    For example (1D-2D)

    let V='1D and W='x width' position' then in 2d

    x=V MOD W

    y=(v-(V MOD W))/w

  5. #5
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    As a more practical whatever example:

    1 mod 3 = 1
    2 mod 3 = 2
    3 mod 3 = 0
    5 mod 3 = 2
    8 mod 3 = 2
    8 mod 3 = 0

  6. #6
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    By practical you mean incorrect?
    8 mod 3 = 2

  7. #7
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    1,812
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    I think of mod as a circle. Once you've reached the desired end you go back to the start.

  8. #8
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    It's just a shame most mod implementations don't handle negative numbers.. that'd be so much more useful (although I saw some that did before.. not sure in which language though) - especially with rotations.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    And an even more practical example:

    128 seconds:
    128 / 60 = 2
    128 mod 60 = 8

    128 seconds = 2 minutes and 8 seconds

  10. #10
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Quick Question about "Mod" operator

    Quote Originally Posted by Random
    It's just a shame most mod implementations don't handle negative numbers.. that'd be so much more useful (although I saw some that did before.. not sure in which language though) - especially with rotations.
    I think it does, but like this:
    -128 / 60 = -2
    -128 mod 60 = -8

    To wrap it positive IIRC you do this:
    ((number mod limit) + limit) mod limit)

Page 1 of 2 1 2 LastLast

Similar Threads

  1. "Cannot load joystick2.mfx" when "Compress the runtime" unchecked. Fine when checked.
    By DistantJ in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 14th September 2013, 09:44 PM
  2. Quick "ForEach" question
    By alspal in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 20th April 2012, 03:22 PM
  3. "Bug" For Saving and Loading Frame Positions AND "Timer Glitch"?
    By Zarpo in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 27th March 2012, 12:40 PM
  4. Quick Time object & "User clicks..." problem
    By kikiriki in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th December 2010, 11:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •