Modulo Different in 4.2.2

In Blender 4.2.2. the Math Node has "truncated modulo" and "floored modulo". What is the different between the 2 and which would be the right one for the exercise? When I select truncated modulo and use a value of 2 the gondolas appear at every 2nd point on the circle, but without using the node, the gondolas appear at each point. Is the modulo node still required in 4.2.2?
1 love
Reply
  • Martin Bergwerf replied

    Hi aaaronstarlin ,

    Yes, the Modulo is still needed.

    The difference is, that the result gets either 'Floored' or 'Truncated'. This only makes a difference if the result of the Modulo is negative.

    For instance: -2.71828...Truncated is -2 (get rid of everything after the decimal point), while -2.71828... Floored is -3 (the highest integer smaller than, or equal to).

    The Modulo itself still works in the exact same way and in this case, the result is always an Integer anyway, so it doesn't matter which one you use.

    2 loves
  • hapit replied

    I searched for it almost at the same time.

    To add additional context: I found the Chat, where the feature was implemented. There is a picture which illustrates the difference very good.
    https://projects.blender.org/blender/blender/pulls/110728Β 

    Truncated is symetrical around zero and floored is always "left".

    • πŸ‘πŸ‘
    • πŸ‘πŸΌNice!
    3 loves
  • Ingmar Franz(duerer) replied

    One question concerning "Truncated Modulo": Why does for example 8 divided 0.4 equal to 0.4? I would expect 0 since 0.4 fits 20 times into 8 so that the remainder is 0.0 or truncated 0. File is here.lo_22Dez2024_Nr3.png

  • Martin Bergwerf replied

    Hi Ingmar duerer ,

    I have no idea how programmer's modulo works.

    I just know the mathematical modulo and that is only defined with whole numbers. Even modulo 1 is not defined (like dividing by 0).

    But Truncated Modulo gives the same result as Modulo used to (if your not using negative numbers):

    Modulo.png

    3 loves