natural log (ln^X) function

natural log (ln^X) function

Post by Brian Nordber » Fri, 08 Mar 2002 07:50:17



Does anyone know of a way to calculate the natural log of
a field in SQL server 2000 (TSQL)
thanks
Brian
 
 
 

natural log (ln^X) function

Post by Mikhail Berlyan » Fri, 08 Mar 2002 08:03:10


LOG(FieldName)

Mikhail Berlyant
Data Integrator, Yahoo!Music   www.yahoo.com
Brainbench MVP for Visual Basic   www.brainbench.com


Quote:> Does anyone know of a way to calculate the natural log of
> a field in SQL server 2000 (TSQL)
> thanks
> Brian


 
 
 

natural log (ln^X) function

Post by Joe Celk » Fri, 08 Mar 2002 08:15:51


LOG()returns the natural logarithm for the given FLOAT expression.  The
bad news that what SQL calls natural logarithms are calculated by using
the base-2 system.  However, the LOG10() function returns the base-10
logarithm.

Look at http://www.sosmath.com/algebra/logs/ for some help:

LN(x) =
log10(x)/log10(2.71828182845904523536028747135266249775724709369995...)

--CELKO--
 ===========================
 Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

natural log (ln^X) function

Post by Steve Kas » Fri, 08 Mar 2002 08:27:01


Brian,

  Mikhail was correct.  LOG() is the natural log.  You can check that
select log(2.718281828459045) returns 1.0.

  Joe's expression is also correct in T-SQL, though not in SQL-92.  There
is no LOG() function in SQL-92.

Steve Kass
Drew University


> LOG()returns the natural logarithm for the given FLOAT expression.  The
> bad news that what SQL calls natural logarithms are calculated by using
> the base-2 system.  However, the LOG10() function returns the base-10
> logarithm.

> Look at http://www.sosmath.com/algebra/logs/ for some help:

> LN(x) =
> log10(x)/log10(2.71828182845904523536028747135266249775724709369995...)

> --CELKO--
>  ===========================
>  Please post DDL, so that people do not have to guess what the keys,
> constraints, Declarative Referential Integrity, datatypes, etc. in your
> schema are.

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

 
 
 

1. help: LN function use in pl/sql

Hi there:
I came cross a problem using LN (or LOG) SQL function in pl/sql code
within form 4.5 application.  I am trying to do some intermediate
calculation based on one table column and store in another table column.
Her is the code from a procedure looks like:
        begin
        ....
        UPDATE one_table
                SET one_col = LN(another_col) * some_constant;
        .....
        end;
The problem is that I can not simply compile this code, because LN is not
recognized.  The reference book says that all these SQL function are
supported in PL/SQL.  And I did try other SQL function like SQRT, it works
fine.

        Could anyone out there help me identify the problem with that.
I'm running form 4.5 on Window 3.1 machine off ORACLE 7.3 server.
I'd appreciate very much for any help.

================================================================================
Weixing Chen

================================================================================

2. What's the difference between DBWR_IO_SLAVES and DB_WRITER_PROCESSES?

3. compound sums without log nor ln

4. EDI tools

5. NATURAL 1.2 vs NATURAL 2.

6. Use OF * or ? In SQL query through VB

7. Function to do natural sort of string number?

8. UPDATE Trigger in VFP6

9. LN - ODBC - AS400 Select statement

10. Wanted: Software-Developer Oracle/CDE for munich, frankfurt, stuttgart and k?ln, germany

11. Function of transaction log

12. How to log on from within a function ?

13. Accuracy of the log function