[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Re: frac semantic



sorry, even after rereading the thread, I don't get it. A change of semantics implies a change of behaviour. Or do you mean you want to change the implementation without changing the behaviour?


At 11:32 Uhr -0800 17.12.2009, Scott Carver wrote:
The lang version of .frac is equivalent to n%1.

this is not so, at least in my build:

-1.2.frac // -0.2
1.2.frac // 0.2

-1.2 % 1 // 0.8
1.2 % 1 // 0.2

f = FunctionList([{ |x| x - floor(x) }, _.frac, _ % 1]);
f.([1.2, 0, -1.2]);

// [ [ 0.2, 0, 0.8 ], [ 0.2, 0, -0.2 ], [ 0.2, 0, 0.8 ] ]





On 12/21/2009 11:47 AM, Julian Rohrhuber wrote:
 The lang version of .frac is equivalent to n%1. In terms of
 usefulness, then, it might be better to go with the ugen definition
 of .frac, so both possibilities are covered.


 The lang version currently is the same as the ugen version:



 -1.2.frac // -0.2
 1.2.frac // 0.2
 { DC.ar(-1.2).frac.poll }.play; // -0.2
 { DC.ar(1.2).frac.poll }.play; // 0.2

you may want to check the sources. the ugen implements arg - floor(arg),
the language as arg - trunc(arg). the trunc implementation relies on a
specific rounding mode ... since it is not set, the trunc implementation
doesn't necessarily behave as it should.

 yes, i would also prefer this behavior ... if no one objects, i will
 commit a patch, changing the sclang semantic of frac to match the unit
 generator ...

 so what of the above behavior is changed by your patch?

arg - floor(arg), as described earlier in this thread

tim

--
tim@xxxxxxxxxx
http://tim.klingt.org

Happiness is a byproduct of function, purpose, and conflict; those who
seek happiness for itself seek victory without war.
  William S. Burroughs


Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

Attachment converted: data:signature 1131.asc (    /    ) (00051D25)


--





.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/