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

converting to a smaller precision (fewer or no decimals after decimal point) should round/truncate consistently #6193

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

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2017-01-27 11:23:33 +0100
From: @sjoerdmullender
To: SQL devs <>
Version: 11.25.5 (Dec2016-SP1)

Last updated: 2017-03-03 10:24:57 +0100

Comment 24921

Date: 2017-01-27 11:23:33 +0100
From: @sjoerdmullender

Even though we're allowed to truncate or round at our discretion, it would be good if we were consistent.

There are also some bugs where rounding is implemented incorrectly.

See allso (closed) bugs 3744, 3310.

Comment 24922

Date: 2017-01-27 11:39:20 +0100
From: MonetDB Mercurial Repository <>

Changeset 412cc3428d91 made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

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

Changeset description:

Be consistent about rounding or truncating values.

There is now a symbol TRUNCATE_NUMBERS that, if defined, which it
currently is not, will cause the code to always truncate towards zero
when values need to be converted from higher precision (number of
decimals after the decimal point) to lower precision, including from
floating point to integer.  Without the symbol, we always round.
This checkin also fixes some rounding bugs (don't add 0.5 to a
negative number and then truncate toward zero).

This fixes bug #6193.

Also added test.

Comment 24923

Date: 2017-01-27 11:41:04 +0100
From: @sjoerdmullender

This bug was fixed.
Since changeset 412cc3428d91 (which will be in the Dec2016-SP2 release), we round consistently, but there is a compile-time option to always truncate.

Comment 25132

Date: 2017-03-03 10:24:57 +0100
From: @sjoerdmullender

Dec2016-SP2 has been released, incorporating the fix.

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

Successfully merging a pull request may close this issue.

None yet
1 participant