On Sat, 27 Nov 2004, Miller Puckette wrote:
Pd offers a 'div' which should perhaps have been named 'floor'. It does 'correct' integer division so that Y = X * div(Y,X) + mod(Y,X).
Well, in C/C++, floor is a function with only one argument, and in Ruby it's a method of the Float class with zero arguments, and that covers pretty much everything called "floor" that I am aware of, so it shouldn't be called floor; there's the special case [div 1] which would be a special case of floor, but the rest doesn't follow: the only other argument I could imagine to floor that would make sense would be a granularity setting, like:
| [div g] | [* g] |
The defining feature of floor(x,g) being that x=floor(x,g) exactly when x is a multiple of g. This is most especially useful (and usual) as floor(x,0.01) for rounding to two decimals, or floor(x,pow(10,-n)) for rounding to n decimals.
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju