according to the supercollider docs, the frac operator is defined as:
frac .. fractional part [1]
the unit generator implements it as defined in wikipedia (according to
Graham, Knuth, & Patashnik) [2]:
x - floor(x)
the language as defined at wolfram [3] and the c99 modf function [4]:
x - trunc(x)
for positive x, the result is the same, for negative x, the first
formula returns positive values, the second version negative values.
the only version, where this is actually used in the class library is
the implementation of LinLin. for this use case, the implementation
doesn't matter though:
^LinLin.ar(in.frac, 0.0, 1.0, val0, val1);
^LinLin.kr(in.frac, 0.0, 1.0, val0, val1);
although i don't like breaking backwards compatibility, i think, it is
useful here in order a consistent behavior in language and server.
especially since the specification is not precise. it shouldn't touch
too much code and if people made use of it, i hope, they were aware of
the imprecise specification. personally i am not sure about the best
definition, though ... while i like using the definitions, used by
mathematicians, i also like the consistency with modf.
so, i'd be curious to hear thoughts about this ...
tim
[1] build/Help/Language/Operators.html
[2] http://en.wikipedia.org/wiki/Floor_and_ceiling_functions#Fractional_part
[3] http://mathworld.wolfram.com/FractionalPart.html
[4] http://opengroup.org/onlinepubs/007908799/xsh/modf.html
--
tim@xxxxxxxxxx
http://tim.klingt.org
It is better to make a piece of music than to perform one, better to
perform one than to listen to one, better to listen to one than to
misuse it as a means of distraction, entertainment, or acquisition of
'culture'.
John Cage