Re: greatest multiple algorithm



Bronson <pshemu@xxxxxxxxx> writes:
Hi,

i'm looking for a fast way to find greatest multiple of a, which is
smaller than b.
Recently i've used b-b%a, but maybe it could be done faster.

Any ideas?

floor(b/a)*a

If a is known in advance and within certain ranges, that's
two operations.

Phil
--
"Home taping is killing big business profits. We left this side blank
so you can help." -- Dead Kennedys, written upon the B-side of tapes of
/In God We Trust, Inc./.
.



Relevant Pages

  • Re: here are videos of two puzzles you can do in a bar:
    ... operator is a multiple. ... are dumb. ... /In God We Trust, Inc./. ...
    (rec.puzzles)
  • Re: A Question about The Tzimtzum...
    ... Multiple authors bring multiple theologies (as Richard E. Friedman points ... the biblical cosmos is radically different than the modern-scientific ... Whether the Deep was created ex nihilo at some earlier ... in Psalms which suggests that God did create the Deep, ...
    (soc.culture.jewish.moderated)
  • Re: Early Urban Fantasy
    ... Taltos novels of a god as a being able to exist in multiple places ... Madrox isn't a god, nor is Uzumaki Naruto, but both can be in multiple ...
    (rec.arts.sf.written)
  • Re: Dorothy? Were definitely in Kansas, dear.
    ... > Why doesn't taking medicine show that you trust in the medicine more ... medicine wouldn't be a matter of multiple supports. ... the belief than in doing so they are relying completely on God. ... Compare this to the idea of carrying a charm for luck. ...
    (rec.arts.sf.composition)
  • Re: Superman/Batman #25 (Spoiler-ish)
    ... for god knows how long? ... characters from multiple timelines, characters bouncing around from ... I won't say it was boring, ...
    (rec.arts.comics.dc.universe)