4 ms·
I am curious, what exactly "feq" is calculating? > return !((x < y) | (x > y)); Is it supposed to avoid x == y. If yes, why?
by aquarin 3y ago
I am curious, what exactly "feq" is calculating?
> return !((x < y) | (x > y));
Is it supposed to avoid x == y. If yes, why?
- aquarin 3y agoAlso, "length" may have better be implemented using: https://en.cppreference.com/w/c/numeric/math/hypot https://en.cppreference.com/w/c/numeric/math/hypot It will be helpful, if you add comments discussing why certain functions are implemented in that way, and what algorithms (references) is used. For example, there are some magic numbers without explanation: if (cap < 1000) { Have you looked at: https://github.com/davideberly/GeometricTools https://github.com/davideberly/GeometricTools Each algorithm is well documented and explained. There is even a short pdf papers for some of the algorithms explainimg why some decisions are taken and what numerical issues may be expected.
- WithinReason 3y agoIt implements x==y, but it's also true when one of them is a NaN
- aquarin 3y agoI understand. You want to work with NaN-s for some reason.
- MobiusHorizons 3y agoI think this might handle NaN differently than == does, I believe the comparisons would always be false with NaN. I’m not sure if that is the intent though.