Skip to content

[Bug] doris Function round imprecision #32942

Description

@longzmkm

Search before asking

  • I had searched in the issues and found no similar issues.

Version

doris-2.1.0-rc11-91efb6a43d

What's Wrong?

CREATE TABLE test_double (
report_date date,
v double NULL
) engine=OLAP
DUPLICATE KEY(report_date)
DISTRIBUTED BY HASH(report_date) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2",
"disable_auto_compaction" = "false"
);

INSERT INTO test_double (report_date, v) VALUES
('2024-03-19', NULL),
('2024-03-19', '2'),
('2024-03-19', '0'),
('2024-03-19', '0'),
('2024-03-19', '0'),
('2024-03-19', '0'),
('2024-03-19', '1'),
('2024-03-19', NULL),
('2024-03-19', '0.5'),
('2024-03-19', NULL),
('2024-03-19', NULL),
('2024-03-19', NULL),
('2024-03-19', NULL),
('2024-03-19', '0'),
('2024-03-19', '1'),
('2024-03-19', '0'),
('2024-03-19', NULL);

SELECT
report_date,
ROUND(4.5,0),
round(v_total,0),
v_total
from
(
SELECT
test_double.report_date,
sum(COALESCE(v,0)) as "v_total"
from test_double
GROUP by
test_double.report_date
)a;

image

why round(v_total,0) = 4 but 5 is true

What You Expected?

why round(v_total,0) = 4 but 5 is true

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions