3 ms·
>which means the calling code is multiplying by a factor of pi just so the library code can immediately divide it back out again. Mathematical philosophy aside
by NaturalPhallacy 4y ago
>which means the calling code is multiplying by a factor of pi just so the library code can immediately divide it back out again.
Mathematical philosophy aside, that's a pretty compelling argument from a practical perspective. You're doing two unnecessary relatively expensive (multiply/divide) operations in a process that's supposed to be fast.
- rkagerer 4y agoIn practice how likely is it the compiler will optimize away the redundant operations? Is the library boundary typically a barrier to optimization?
- NaturalPhallacy 4y agoIf the compiler isn't compiling the library too, I would assume yes.