4 ms·
> why squaring numbers is so important that it needs a special function I've had pow2() in pretty much every codebase I'd worked on, ever. pow2(x1-x0) looks ni
by Jare 5y ago
> why squaring numbers is so important that it needs a special function
I've had pow2() in pretty much every codebase I'd worked on, ever. pow2(x1-x0) looks nicer and less error prone than (x1-x0)*(x1-x0), and less verbose and distracting than first separating to a local var as dx = x1-x0
- toxik 5y agoWhat about using an actual vector library like Eigen? I wouldn’t dream of reimplementing basic maths like that.