Is there a way to perform the basic modulo operation on two UInt operands?

Added by: tomek, 2010 V 13

UInt<2> a, b, remainder;

a = 100;
b = 30;

a.Div(b, &remainder);

std::cout << a << std::endl;
std::cout << remainder << std::endl;

Added by: ~Troy, 2010 V 13

Perfect, thanks a lot! Can't wait for some documentation. ;)

Added by: ~Troy, 2010 V 14

Does the Div() function actually provide real modulo or is there rounding involved? I'm getting unpredictable answers with the program I wrote. What I need is either a remainder that is a floating point, or at the very least I need Div() to always round up. (ceiling) I don't care much what the remainder is, I just need to know whether or not it is zero.

Added by: ~Friend, 2010 V 25

Huh? how can you get a floating point from this operation?

Added by: ~LB, 2010 VIII 15

You can just use %= operator...