Top "Modulo" questions

The modulo (sometimes called modulus) operation finds the remainder of division of one number by another.

Is there any alternative to using % (modulus) in C/C++?

I read somewhere once that the modulus operator is inefficient on small embedded devices like 8 bit micro-controllers that do not …

c++ c modulo embedded
How does a modulo operation work when the first number is smaller?

I'm messing with the modulo operation in python and I understand that it will spit back what the remainder is. …

modulo
Python modulo on floats

Can anyone explain how the modulo operator works in Python? I cannot understand why 3.5 % 0.1 = 0.1.

python modulo
Why do people say there is modulo bias when using a random number generator?

I have seen this question asked a lot but never seen a true concrete answer to it. So I am …

c++ random language-agnostic modulo
Check if a number is divisible by 3

Write code to determine if a number is divisible by 3. The input to the function is a single bit, 0 or 1, …

puzzle division modulo
Floating Point Modulo Operation

I am trying to implement the range reduction operation for trigonometry. But instead I think it might be better to …

c assembly binary floating-point modulo
Best way to make Java's modulus behave like it should with negative numbers?

In java when you do a % b If a is negative, it will return a negative result, instead of wrapping …

java modulo negative-number
C: How to wrap a float to the interval [-pi, pi)

I'm looking for some nice C code that will accomplish effectively: while (deltaPhase >= M_PI) deltaPhase -= M_TWOPI; …

c math floating-point intervals modulo
Modulus with negative numbers in C++

I have been writing a program for the following recurrence relation: An = 5An-1 - 2An-2 - An-3 + An-4 The output …

c++ modulo recurrence
Is it better to avoid using the mod operator when possible?

I assume that calculating the modulus of a number is a somewhat expensive operation, at least compared to simple arithmetic …

c performance optimization modulo