[ https://issues.apache.org/jira/browse/CALCITE-6232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17813352#comment-17813352 ]
Julian Hyde edited comment on CALCITE-6232 at 2/1/24 5:40 PM: -------------------------------------------------------------- The summary is extremely unhelpful. It might as well say "Using subtraction in LOG function does not return correct results" because LOG(5 - 5) returns -Inf. The subtraction, or division, is not the problem. It is the handling of zero. Apply the doctrine of the minimal test case. If the problem arises in LOG(2 / 3), does it also apply with LOG(.67) or LOG(0) or 2/ 3? Turns out that the OP has a problem with how Calcite evaluates 2 / 3 but I am NOT going to litigate that in a bug that is ostensibly about LOG. This bug is closed. Open a new case that is focused on one thing. was (Author: julianhyde): The summary is extremely unhelpful. It might as well say "Using subtraction in LOG function does not return correct results" because LOG(5 - 5) returns -Inf. The subtraction, or division, is not the problem. It is the handling of zero. > Using fractions and 0 in LOG function does not return correct results > --------------------------------------------------------------------- > > Key: CALCITE-6232 > URL: https://issues.apache.org/jira/browse/CALCITE-6232 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.36.0 > Reporter: Caican Cai > Priority: Minor > Fix For: 1.37.0 > > > The correct result in mysql is as follows > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +---------------------+ > | result | > +---------------------+ > | -0.1760912594899757 | > +---------------------+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > +--------+ > | result | > +--------+ > | NULL | > +--------+ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +---------------------+ > | result | > +---------------------+ > | -0.5849625021638512 | > +---------------------+ > 1 row in set (0.00 sec) > > {code} > The log2 and log10 results of calcite are -Infinity -- This message was sent by Atlassian Jira (v8.20.10#820010)