playMaker

Author Topic: Float Modulo  (Read 4468 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Float Modulo
« on: June 19, 2013, 03:32:11 AM »
Hi,
 
Following a post where float modulo was required, I created a custom action for it.

bye,

 Jean

Ryandb2

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Float Modulo
« Reply #1 on: July 30, 2016, 03:59:59 PM »
Just in case anyone is thinking of using this function, its worth noting this is not a modulo operation, but rather a remainder operation. % in C# is remainder which will present different results in negative divisor or dividend cases than a true modulo.

https://blogs.msdn.microsoft.com/ericlippert/2011/12/05/whats-the-difference-remainder-vs-modulus/

Stumbled on this as I was getting effectively invalid results for a typical mod operation.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Float Modulo
« Reply #2 on: August 01, 2016, 05:21:10 AM »
Hi,

 ok, very confusing indeed:

http://www.dotnetperls.com/modulo

So, where could I find some definite code on creating a modulo and a remainder.

Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Float Modulo
« Reply #3 on: August 01, 2016, 05:24:17 AM »
Hi,

 found this: http://cc.davelozinski.com/c-sharp/use-the-modulus-operator-or-alternative

 so, what would be a typical case to check that modulo and remainder are properly working?

Bye,

 Jean