in reply to Best way to make sure a number is an even multiple of another?

demerphq,
I am not sure how large your numbers are, so the following approach may not be what you need/want: If I get a chance, I might even try and implementation.

Cheers - L~R

  • Comment on Re: Best way to make sure a number is an even multiple of another?

Replies are listed 'Best First'.
Re^2: Best way to make sure a number is an even multiple of another?
by demerphq (Chancellor) on Oct 21, 2004 at 13:10 UTC

    $n will be small. Assume its a 16 bit integer.


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi

      Flux8


      demerphq,
      I am guilty. I am guilty of not spending enough time reading your question to see what you were asking for before jumping to conclusions. The conclusion I jumped to is that you wanted the largest factor greater than or equal to a certain number. To that end, here is code that I believe does that. While I know that this isn't what you asked for, it might be of benefit to someone.

      Cheers - L~R