Home > T-SQL > SQL SERVER – Logarithm Log() – SQL Math Functions @SQLSERVER

SQL SERVER – Logarithm Log() – SQL Math Functions @SQLSERVER


LOG() function returns the natural logarithm of the specified float expression. If the expression is integer than it will be converted to a float type implicitly. It also returns a float value.

If the base of the log is not given then it uses the natural logarithm to the base e. e is an irrational constant value.

e ≈ 2.718281828

Logarithms were introduced by John Napier in the early 17th century as a means to simplify calculations. –Wikipedia

Syntax

LOG ( float expression [, base ] )

Example

–Natural Logarithm, without base value
select log(2)
Output: 0.693147180559945
 
–Logarithm to the specified base, with base value
select log(2, 2)
Output: 1
 
–Logarithm to the specified base, with base value e
select log(2, 2.718281828)
Output:0.693147180676999
 

Logarithm is used by navigators, scientists, engineers, and others to perform computations more easily. In public-key cryptography application, discrete logarithm is used to generate keys.

Explore more with Log() function.

Advertisements
  1. No comments yet.
  1. December 24, 2012 at 11:24 pm
  2. December 25, 2012 at 11:37 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: