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

cast to int gives different results for decimal than double #3744

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

cast to int gives different results for decimal than double #3744

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

Comments

@monetdb-team
Copy link

Date: 2015-06-22 16:13:53 +0200
From: @bartscheers
To: SQL devs <>
Version: 11.19.15 (Oct2014-SP4)
CC: @njnes

Last updated: 2015-08-28 13:42:59 +0200

Comment 20938

Date: 2015-06-22 16:13:53 +0200
From: @bartscheers

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

A cast to int for a decimal value rounds the value off to closest int, while double is cast to truncated value.

Reproducible: Always

Steps to Reproduce:

  1. select cast(cast(13.8 as decimal(10,7)) as int);
  2. select cast(cast(13.8 as double) as int);

Actual Results:

+------+
| L2 |
+======+
| 14 |
+------+
1 tuple
+------+
| L2 |
+======+
| 13 |
+------+
1 tuple

Expected Results:

At least identical behaviour.

+------+
| L2 |
+======+
| 13 |
+------+
1 tuple
+------+
| L2 |
+======+
| 13 |
+------+
1 tuple

Comment 20940

Date: 2015-06-22 21:43:25 +0200
From: @njnes

fixed in jul2015 branch

Comment 21226

Date: 2015-08-28 13:42:59 +0200
From: @sjoerdmullender

Jul2015 has been released.

@monetdb-team monetdb-team added bug Something isn't working normal 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 normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants