On 3 March 2015, frantisek holop <[email protected]> wrote:
> Joerg Sonnenberger, 03 Mar 2015 17:28:
> > On Tue, Mar 03, 2015 at 05:02:39PM +0100, frantisek holop wrote:
> > > i leave the battle about lg vs log to others,
> > > but i prefer 'log' as there is a man page for that
> > > and there is none for 'lg'...
> >
> > If anything, it should be "log" because that is the name of the
> > mathematical function. libm is completely irrelevant in this context.
>
> 'lg' is also a valid name
> (altough i admit i didn't know, i was used to log2)
> https://en.wikipedia.org/wiki/Logarithm#Particular_bases
>
> as Tedu pointed out lg = log2 and lg != log
Actually, that isn't what Tedu said, and it isn't the generally
accepted convention. The usual convention is:
* log = ln = log_e
* lg = log_10
As somebody else points out, they differ from each other by
multiplicative constants, so either are correct for O-notation.
(Full disclosure: I'm a mathematician. :))
> but i think my point is still kind of valid,
> as there is log2(3) and no lg(3).
>
> i find it relevant that libm should also use
> the most common, easiest names where possible...
> it is kind of nice to be able to do 'man log2'
> after reading 'man qsort', a kind of indirect
> cross reference.
Regards,
Liviu Daia