Bug #36268 Documentation : LOG() : "Arbitrary base"
Submitted: 22 Apr 2008 22:31 Modified: 25 Apr 2008 15:24
Reporter: Carsten Pedersen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[22 Apr 2008 22:31] Carsten Pedersen
Description:
http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_log

"If called with two parameters, this function returns the logarithm of X for an arbitrary base B."

Perhaps arguable, but B isn't totally arbitrary, as it must be greater than 0. (e.g. POW(-2, 4) returns 16, but LOG(-2, 16) returns NULL).

How to repeat:
Read the docs ;-)

Suggested fix:
"...for an arbitrary base B greater than 0."
[22 Apr 2008 23:06] Jon Stephens
The logarithm of X to the base B is obtained as log(X) / log(B).

log(0) is defined as -[infinity], and log(X) where X < 0 is undefined (NaN).

Division by either of these values is not permitted.

Thus, attempting to use a base of 0 or less should return anything - it should instead fail with an error.

Thus, this is a bug in the server.
[22 Apr 2008 23:07] Jon Stephens
Previous comment should read "should NOT return anything".
[23 Apr 2008 6:56] Carsten Pedersen
I don't see why this would be a server bug. NULL is what I expect for illegal values, such as division by zero or sqrt(-1). Defining LOG() as only taking positive values is fine, but it should of course be documented.
[25 Apr 2008 10:52] Sveta Smirnova
Thank you for the report.

I don't see real bug here. But it is no harm to reflect this in documentation. So verified as documentation bug.

Nothing inconsistent with server as it handles division by zero (for example) in same way.
[25 Apr 2008 15:24] Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.