pow(3): warn against ineffecient uses?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Maybe it would be appropriate to warn against inefficient
uses of the function pow. To make a very first proposal
for a paragraph to be added to pow(3):

In time-critical code, pow with small integer or simple
fractional exponents should be avoided in favor of
straightforward multiplication, division or square or
cubic roots: prefer x*x over pow(x,2), 1/x over pow(x,-1),
sqrt(x) over pow(x,0.5), or cbrt(x*x) over pow(x,2.0/3).

My motivation for this proposal comes from student code
in which I have seen exactly these mistakes.

- Joachim

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux