On Sun, Jun 29, 2008 at 1:39 PM, Daniel Richman
<[EMAIL PROTECTED]> wrote:
> Sorry, I just realized that won't work for floating point numbers. But you
> can check if the number is an integer first, then use the % operand if so.
For floating-point modulus, one can use fmod(), fmodl(), or fmodf(),
the '%' operator cannot be used with floating point values, but it
works well with integer:
=> (11 + 2) % 12 = 1
Le 29 juin 08 à 19:34, Daniel Richman a écrit :
Use
double newNumber = oldNumber % 13;
This will return your number's remainder when dividing between 13,
which could be 0 - 1
Sorry, I just realized that won't work for floating point numbers. But
you can check if the number is an integer first, then use the % operand
if so.
Daniel
Daniel Richman wrote:
Use
double newNumber = oldNumber % 13;
This will return your number's remainder when dividing between 13,
whic
Use
double newNumber = oldNumber % 13;
This will return your number's remainder when dividing between 13, which
could be 0 - 12.
Daniel
Ashley Perrien wrote:
Is there a fairly simple way of setting up a clock style looping of
numbers? Where 1-12 act normally but 11 + 2 would return 1 and s