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

[sc-dev] Re: .frac, .sign - perhaps other SimpleNumber primitives???



> On a second look, the frac UnaryOp UGen doesn't use sc_frac, but the  
> nova-simd stuff now. Still it seems it suffers from the same rounding  
> error.

hm, maybe the issue is more complex ... the unary op ugen behaves
differently from the SimpleNumber

i just saw, frac_a is implemented as:

LOOP(inNumSamples,
	float xa = ZXP(a);
	ZXP(out) = xa - std::floor(xa);
);

so it is not the same operation as sc_frac, which is implemented as:

inline float32 sc_frac(float32 x)
{
	return x - sc_trunc(x);
}

... so for negative input values, the fractional part will be negative
in sclang, but positive in scsynth (without the nova-simd patch).

this is inconsistent and imo should be changed. since it changes the
behavior, i would like to hear, what other people think about this
issue, though ...

thnx, tim

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

Our products just aren't engineered for security.
  Brian Valentine, Microsoft's vice president of Windows development

Attachment: signature.asc
Description: OpenPGP digital signature