[Perl] logaritmo NO neperiano

Antonio Galicia jcgalici en agc.com.mx
Mar Ago 29 10:11:26 CDT 2006


El Tue, Aug 29, 2006 at 10:13:00AM +0200, John A. Roberto escribio:

> Mi pregunta del día es cuál es la función que Perl
> utiliza para obtener un algoritmo en base 10, pues la
> función log(x) me regresa el logaritmo neperiano de x.

 $ perldoc -f log

       log EXPR
       log     Returns the natural logarithm (base e) of EXPR.  If EXPR is
               omitted, returns log of $_.  To get the log of another base,
               use basic algebra: The base-N log of a number is equal to the
               natural log of that number divided by the natural log of N.
               For example:

                   sub log10 {
                       my $n = shift;
                       return log($n)/log(10);
                   }

               See also "exp" for the inverse operation.
 
-- 
 Saludos,
 Toño
--
Don't kiss an elephant on the lips today.


Más información sobre la lista de distribución Perl