I noticed you divided by 2 and four instead of multiplying by .5 and .25. Why is that? Division is more expensive in C#. I understand what we're doing is already expensive so, should we save performance wherever possible?
It's likely done to show you in an easier way to understand, leaving optimizations like that out of it. But I think the C# compiler probably does that optimization for you when dividing by a constant.
I noticed you divided by 2 and four instead of multiplying by .5 and .25.
Why is that? Division is more expensive in C#. I understand what we're doing is already expensive so, should we save performance wherever possible?
It's likely done to show you in an easier way to understand, leaving optimizations like that out of it. But I think the C# compiler probably does that optimization for you when dividing by a constant.