David Green wrote:
On 2009-Jul-8, at 3:41 pm, pugs-comm...@feather.perl6.nl wrote:
=item log
+ our Num multi method log ( Num $x: Num $base = Num::e ) is export
Logarithm of base C<$base>, default Natural. Calling with C<$x == 0> is an error.

It occurs to me that "log" is a pretty short name for a function I rarely use. (In fact, I'm not sure I've ever used it in perl.) On the other hand, I -- and a thousand or so CPAN modules -- are always logging stuff in that other popular computer sense. (All right, that number isn't exactly the result of a rigourous study... I did find 57 modules that mentioned logarithms.)

The inertia of tradition weighs heavily here, but perhaps we could call it ln(). (If anyone asks, I'm prepared to say with a straight face that it stands for "log (numeric)".) And/or log(), but with the :base arg mandatory -- then as long as your status logging doesn't have a :base, you can have both.

If you're going to have a "ln" to mean some kind of logarithm, then the only thing that makes sense is for it to mean "natural logarithm" or "N log e". Also, plain "log" should be a dyadic infix or prefix operator where you can use any base/radix. If you want something to mean "log to the base 10" then it should be spelled say "log10", not "log". See, "log" is the most generic version of the name and so it should be the most generic version of the operator, taking base as an argument. -- Darren Duncan

Reply via email to