logoalt Hacker News

zombotyesterday at 12:19 PM5 repliesview on HN

> log(t)

log to what basis? 2 or e or 10 or...

Why do programmers have to be so sloppy?


Replies

anonymous_sorryyesterday at 1:15 PM

It's not sloppiness, it's economy.

You can convert between log bases by multiplying by a constant factor. But any real-world program will also have a constant factor associated with it, depending on the specific work it is doing and the hardware it is running on. So it is usually pointless to consider constant factors when theorising about computer programs in general.

12345ieeeyesterday at 12:20 PM

It doesn't matter in O() notation.

derbOacyesterday at 1:17 PM

One answer, from a certain perspective, is that it's relative to your encoding base. It's logarithmic in operations, with the base depending on the encoding.

eviksyesterday at 12:58 PM

Another reason is because base e notation is ln, not log

show 2 replies
Tarq0nyesterday at 12:34 PM

This is very common. Log without further specification can be assumed to be the natural log (log e).

show 4 replies