SQLite User Forum

sqlite ln vs log
Login

sqlite ln vs log

(1) By tit (thipages) on 2023-03-20 12:12:50 [link] [source]

Hi,

According to the sqlite documentation, log and log10 are considered the same (base-10 logarithm) and ln the natural logarithm.

When I do

select LOG10(10)
-- 1 OK
select LOG(10)
-- 2.302585092994046 (NOK this is a ln computation)
select LN(10)
-- error, no such function ln

Finaly

  • LOG is LN and
  • LN does not exist ...

Help ! Thanks

(2.1) By Tim Streater (Clothears) on 2023-03-20 12:45:58 edited from 2.0 in reply to 1 [link] [source]

You're not running SQLite.

Your example works fine here, just as according to the doc:

tim@Third-Mini Desktop % sqlite3
-- Loading resources from /Users/tim/.sqliterc
SQLite version 3.39.2 2022-07-21 15:24:47
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> 
sqlite> 
sqlite> 
sqlite> select log10(10);
┌───────────┐
│ log10(10) │
├───────────┤
│ 1.0       │
└───────────┘
sqlite> select log(10);
┌─────────┐
│ log(10) │
├─────────┤
│ 1.0     │
└─────────┘
sqlite> select ln(10);
┌──────────────────┐
│      ln(10)      │
├──────────────────┤
│ 2.30258509299405 │
└──────────────────┘
sqlite>

(3) By tit (thipages) on 2023-03-20 22:10:31 in reply to 2.1 [source]

Thanks. I can reproduce it also. The issue seems to be on the tool I used for my tests queries (DBeaver). I will put a word there.

(4) By tit (thipages) on 2023-03-20 22:32:33 in reply to 3 [link] [source]

My issue is fixed.

Here is the story : using DBeaver v23 with sqlite-jdbc-3.39.3.0.jar does what I wrote. this has been fixed recently end of leat year. This seemed to be a regression from 3.35

Thank you.

(5) By Keith Medcalf (kmedcalf) on 2023-03-20 22:41:29 in reply to 4 [link] [source]

So the first reply was spot on. You are not using SQLite3. You are using DBeaver.

(6.1) By tit (thipages) on 2023-03-20 23:06:27 edited from 6.0 in reply to 5 [link] [source]

Correct. I have have posted this issue at the wrong place. I should have report to the SQLite driver devs.

My apologize and ... thanks for your quick answser!

sqlite3 is just great :-)