Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log( x, y ) in fact returns log( y, x ) [CORE343] #682

Closed
firebird-automations opened this issue Jul 21, 2003 · 2 comments
Closed

log( x, y ) in fact returns log( y, x ) [CORE343] #682

firebird-automations opened this issue Jul 21, 2003 · 2 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @paulvink

Assigned to: @samofatov

SFID: 775003#⁠
Submitted By: paulvink

log( x, y ) should return the x-based log of y, according
to the description in ib_udf.sql. But in fact it calculates
and returns ln x / ln y. This is the y-based log of x, and
the _inverse_ of what it should return.

Observed under Windows SS 1.0.0, 1.0.3 and 1.6 Alpha,
but clearly universal if you look at the source in ib_udf.c

A patch - which simply swaps numerator and
denominator in the one-line function body - has been
posted yesterday to firebird-devel.

Leaving the code intact and changing the description is
also an option, but I would strongly advise against that
because:

a) in English and lots of other languages you name the
log base before the number. So it feels natural that a
function returning the base-a log of b should be called
as log( a, b ) -- just as div( a, b ) divides a by b, not b
by a.

b) We also have the UDF log10. If you call log10( 100 ),
the base is before the number. Again, the most natural
thing would be if log10( 100 ) == log( 10, 100 ).

Grtz,
Paul Vinkenoog

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 10367 ] => Firebird [ 14612 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant