[gambit-list] How do you do Log N, Log 2, Log 10 in Gambit?
Marc Feeley
feeley at iro.umontreal.ca
Sat Aug 4 07:35:57 EDT 2018
> On Aug 4, 2018, at 11:14 AM, Adam <adam.mlmb at gmail.com> wrote:
>
> Hi,
>
> How do you do Log N, Log 2 and Log 10 in Gambit?
>
> Thanks!
> Adam
> (exp 1)
2.718281828459045
> (log (exp 1))
1.
> (/ (log 1000) (log 10))
2.9999999999999996
> (/ (log 1024) (log 2))
10.
> (- (integer-length 1024) 1)
10
The procedure integer-length can be useful for exact integers if you want an exact integer result.
Marc
More information about the Gambit-list
mailing list