in reply to Re^2: Best way to make sure a number is an even multiple of another?
in thread Best way to make sure a number is an even multiple of another?

I may have misunderstood this, but with $n = 19 and $m = 3, fix gives 21 which is not an even multiple of 3.

Why not just use $m * $n * 2 ?

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

Replies are listed 'Best First'.
Re^4: Best way to make sure a number is an even multiple of another?
by husker (Chaplain) on Oct 21, 2004 at 14:13 UTC
    7 * 3 = 21?
      7 is not an even number (i.e. - not divisible by 2)
        In this case, there's an overload on the word "even". You're using it in the "divisible by two" sense, whereas in this context it means "an number m divides an integer n evenly if and only if there exists an integer k such that m * k = n". Stated another way, n % m == 0.

        thor

        Feel the white light, the light within
        Be your own disciple, fan the sparks of will
        For all of us waiting, your kingdom will come

        Looking at the table of data provided by demerphq, I suspect you should parse 'even' as 'exact'.

        - another intruder with the mooring of the heat of the Perl

        By "even multiple" I think he means "integer multiple". Looking at the table he provides, he does get "odd" results ($n = 7, $m = 3, fix ($n,$m) = 3).