‎01-04-2018 11:04 PM
I meant using the rifle VI from the palette. 😉
‎01-05-2018 11:07 AM
Wow. Some amazing insights in here.
Can I ask why the scale by power of two is used rather than multiply?
‎01-05-2018 11:50 AM
@StevenD wrote:
Wow. Some amazing insights in here.
Can I ask why the scale by power of two is used rather than multiply?
I will wait to hear from Christian and learn as well but I can observe that a scale by a power of two in binary is simply an arithmetic shift left.
Ben
‎01-05-2018 12:19 PM - edited ‎01-05-2018 01:23 PM
StevenD wrote:Can I ask why the scale by power of two is used rather than multiply?
Multiply is probably a better choice here, because the price can change by a random amount. A multiplication/division by integer powers of two corresponds to an arithmetic shift (not logical shift, important difference when the input is negative) for integers. Even for floating point numbers, only a subset of bits need to be touched, but I doubt it would make a difference on a modern processor (but would be of great help when using paper& pencil :)).
So, yes we should use multiplication here. Shifts/powers of two should be used where it is more natural, e.g. if you would implement the cooley-tuckey fft or a binary search. Sorry about that.