librascal icon indicating copy to clipboard operation
librascal copied to clipboard

rename math::pow to math::fast_pow

Open Luthaf opened this issue 5 years ago • 3 comments

Relying on the same name means that std::pow can be called instead (see https://github.com/cosmo-epfl/librascal/pull/225#discussion_r348050113)

Luthaf avatar Nov 21 '19 09:11 Luthaf

What are the scenarios in which it would risk name-clashing with std::pow? If rename is needed to avoid this, I would favor something like ipow or int_pow, since the function is not "fast" is just implemented specifically for integer exponents.

ceriottm avatar Nov 21 '19 13:11 ceriottm

What are the scenarios in which it would risk name-clashing with std::pow?

For example, in https://github.com/cosmo-epfl/librascal/pull/225#discussion_r348050113, @felixmusil changed some types to make sure a call to math::pow was made, previous code was using std::pow.

Luthaf avatar Nov 21 '19 14:11 Luthaf

Also, since pow is a C function from libm, it exists both as std::pow and ::pow in the global namespace. Thus calling pow without namespace from inside rascal::math can match both std::pow and rascal::math::pow

Luthaf avatar Nov 21 '19 14:11 Luthaf