Log_b(a)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Log_b(a)

Matthew J. Williams
Dear friends,

        What is the Haskell equivlent of log_b(a)? To clarify, log of 36 to
the base 1.5.

        Sincerely
        Matthew J. Williams

Reply | Threaded
Open this post in threaded view
|

Log_b(a)

Daniel Fischer-4
Am Sonntag, 8. M?rz 2009 01:30 schrieb Matthew J. Williams:
> Dear friends,
>
> What is the Haskell equivlent of log_b(a)? To clarify, log of 36 to
> the base 1.5.
>
> Sincerely
> Matthew J. Williams
>

Prelude> :i logBase
class (Fractional a) => Floating a where
  ...
  logBase :: a -> a -> a
  ...
        -- Defined in GHC.Float
Prelude> logBase 1.5 36
8.838045165405818

Cheers,
Daniel
Reply | Threaded
Open this post in threaded view
|

Re: Log_b(a)

Ertugrul Söylemez
In reply to this post by Matthew J. Williams
"Matthew J. Williams" <[hidden email]> wrote:

> Dear friends,
>
> What is the Haskell equivlent of log_b(a)? To clarify, log of 36 to
> the base 1.5.

I know it's probably bad style (because there is a specific function for
this) and also likely less efficient, I prefer to use this:

  log a / log b

Unless performance is significant, I find that more elegant than
logBase.


Greets,
Ertugrul.


--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/