Blueprint modulo node doesn't handle negatives?

Edit: the second TL;DR point should instead read “use this formula to correct for negative divident”. Remember, this fails with something as basic as (3 % 10), but can be used to correct for negative dividents in your error handling.

Nice, I was able to make an “Absolute Modulo” function in my function library to account for this. Thanks for the answer!

b-Abs(a%b)

Isn’t it easier to say a+b in case of a negative number?

In the example:

  • b-Abs(a%b) = 4 - (1%4) = 3
  • a+b = -1 + 4 = 3

Nice, thanks for coming up with the calculation.

Hi all,

Cool post @Dextrices

I have a ‘snippet’ for this in my library. I feel like it is relevant. :smiley:

Cheers

1 Like

You will need to create function which in case of negative…

@Shadowriver, what would be a good name for such a function?