Henri Verbeet hverbeet@gmail.com wrote:
I guess that it's always possible to try justifying one way of doing math as a most preferred one. But in the case when one has to choose between "(a + b) * c" and "a * c + b * c" it's better to use common sense IMO. Since there are numerous ways how to compute linear blending, and every of them will always have subtle differences, is it really possible to plausibly explain a personal preference or justify some choice? Is there really "the true one" instead of considering every way having equal starting value?
Well, you're the one trying to justify changing the current code, but yes.
There's a trade-off between performance and accuracy here. As I said in my initial reply, I don't think it really matters one way or another here, but there may very well be other places where trading accuracy for performance would be a legitimate choice to make. You seem to be arguing that there's no trade-off at all instead. Even if that were true, and it isn't — please read up on floating point computation before continuing that line of argument, that wouldn't justify changing the code, or indeed even arguing about it.
I'm perfectly aware about floating point computations being somewhat tricky regarding accuracy. The starting point is to claim which version should be considered as "the true one", that's why I mentioned common sense. It's pretty fragile to use this kind of argument (or rather playful argumentation?) IMHO because when somebody next time will try to optimize/simplify/change some code that performs math computations it always will be tempting to use same kind of arguments, leading to an endless loop :)