News for hackers. Stuff that matters.
Re:What to do if you get a question you've already seen in a... by Jare on Saturday January 29, 2022 @02:58AM (#30124639)
> 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

Re:What to do if you get a question you've already seen in a... by toxik on Saturday January 29, 2022 @03:01AM (#30124652)
What about using an actual vector library like Eigen? I wouldn’t dream of reimplementing basic maths like that.