Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to...
by spacechild1 on Tuesday May 09, 2023 @07:37PM
(#35881756)
A typically pattern is:
float freq = getParameter(FILTER_FREQUENCY);
float coeff;
if (freq != mFreq) {
coeff = calculateCoeffFromFrequency(freq); // expensive
mFreq = freq;
mCoeff = coeff;
} else {
coeff = mCoeff; // use cached value
}
// use coeff
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to...
by bee_rider on Tuesday May 09, 2023 @10:06PM
(#35882787)
Could you do some threshold-based comparison? What if freq is changed only a little tiny bit?
Re:In Erlang/OTP 27, +0.0 will no longer be exactly equal to...
by spacechild1 on Tuesday May 09, 2023 @11:38PM
(#35883357)
I can certainly imagine cases where this would make sense.
Isn't it strictly faster to simply assign? No branching, no branch predictions, only one instruction in all cases.