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

large results of function exp() are not automatically returned as double #3521

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed
Labels
bug Something isn't working minor SQL

Comments

@monetdb-team
Copy link

Date: 2014-07-25 12:34:30 +0200
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: 11.17.17 (Jan2014-SP2)
CC: @njnes

Last updated: 2014-10-31 14:14:21 +0100

Comment 19928

Date: 2014-07-25 12:34:30 +0200
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0
Build Identifier:

Calling exp(number) function for large numbers (>= 89) returns inf instead of the value as a double.

Reproducible: Always

Steps to Reproduce:

  1. start mserver5
  2. start mclient
  3. Enter: select exp(89), log(exp(89));
    +-----------------+----------------------+
    | L1 | log_exp_single_value |
    +=================+======================+
    | inf | inf |
    +-----------------+----------------------+

Actual Results:

sql>select exp(88), log(exp(88));
+-----------------+----------------------+
| L1 | log_exp_single_value |
+=================+======================+
| 1.65163627e+38 | 88 |
+-----------------+----------------------+
1 tuple (0.894ms)

sql>select exp(89), log(exp(89));
+-----------------+----------------------+
| L1 | log_exp_single_value |
+=================+======================+
| inf | inf |
+-----------------+----------------------+
1 tuple (0.944ms)

sql>select exp(89.0), log(exp(89.0));
+-----------------+----------------------+
| L1 | log_exp_single_value |
+=================+======================+
| inf | inf |
+-----------------+----------------------+
1 tuple (0.642ms)

Expected Results:

When the result of the exp() is too large to be defined as float (which seems to be the default return type), it should return the value as a double.

Possibly exp() should always have return type double instead of float to avoid confusion.

There is a workaround for the problem by using cast( as double) to explicitly comvert the input arguments data type to a double.

sql>select exp(cast(89 as double)), log(exp(cast(89 as double)));
+--------------------------+--------------------------+
| L1 | log_exp_single_value |
+==========================+==========================+
| 4.4896128191743455e+38 | 89 |
+--------------------------+--------------------------+

Comment 19946

Date: 2014-08-04 19:29:52 +0200
From: MonetDB Mercurial Repository <>

Changeset 8f619c2ff336 made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=8f619c2ff336

Changeset description:

fixed bug #3521, ie use exp(double) (and other related math functions) when
the input type isn't a real (ie single precision floating point).

Comment 19947

Date: 2014-08-04 19:30:30 +0200
From: @njnes

close we now (again) use exp(double) when the type is unknown (ie not equal to a real)

Comment 20366

Date: 2014-10-31 14:14:21 +0100
From: @sjoerdmullender

Oct2014 has been released.

@monetdb-team monetdb-team added bug Something isn't working minor SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor SQL
Projects
None yet
Development

No branches or pull requests

2 participants