Skip to content

Change accurate comparison of integer and float to be more consistent across different CPU#22595

Merged
alexey-milovidov merged 6 commits intomasterfrom
change-accurate-comparison
Apr 5, 2021
Merged

Change accurate comparison of integer and float to be more consistent across different CPU#22595
alexey-milovidov merged 6 commits intomasterfrom
change-accurate-comparison

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Member

@alexey-milovidov alexey-milovidov commented Apr 4, 2021

Changelog category (leave one):

  • Backward Incompatible Change

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Change comparison of integers and floating point numbers when integer is not exactly representable in the floating point data type. In new version comparison will return false as the rounding error will occur. Example: 9223372036854775808.0 != 9223372036854775808, because the number 9223372036854775808 is not representable as floating point number exactly (and 9223372036854775808.0 is rounded to 9223372036854776000.0). But in previous version the comparison will return as the numbers are equal, because if the floating point number 9223372036854776000.0 get converted back to UInt64, it will yield 9223372036854775808. For the reference, the Python programming language also treats these numbers as equal. But this behaviour was dependend on CPU model (different results on AMD64 and AArch64 for some out-of-range numbers), so we make the comparison more precise. It will treat int and float numbers equal only if int is represented in floating point type exactly.

@robot-clickhouse robot-clickhouse added the pr-backward-incompatible Pull request with backwards incompatible changes label Apr 4, 2021
@kitaisreal kitaisreal self-assigned this Apr 4, 2021
@alexey-milovidov
Copy link
Copy Markdown
Member Author

01455_shard_leaf_max_rows_bytes_to_read

@KochetovNicolai

@alexey-milovidov
Copy link
Copy Markdown
Member Author

00816_long_concurrent_alter_column

#22628

@alexey-milovidov alexey-milovidov merged commit a9eb7a7 into master Apr 5, 2021
@alexey-milovidov alexey-milovidov deleted the change-accurate-comparison branch April 5, 2021 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backward-incompatible Pull request with backwards incompatible changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants