[MDEV-30043] The negative result of the bitwise operator Created: 2022-11-20  Updated: 2022-11-20  Resolved: 2022-11-20

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.9.4
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: 王瑞丰 Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

mariadb docker



 Description   

Consider the following statements:

SELECT -5 & -4; – expected: -8, actual: 18446744073709551608
SELECT '-5' | '-4'; – expected: -3, actual: 18446744073709551615
SELECT '5' ^ '-4'; – expected: -7, actual: 18446744073709551609
SELECT ~5; – expected: -6, actual: 18446744073709551610
SELECT -3 > ('5' ^ '-4'); – expected: 1, actual: 0

The result should be negative, but it actually becomes a large value, We think this should be a spillover issue.

version :10.9.4-MariaDB-1:10.9.4+maria~ubu2204



 Comments   
Comment by Sergei Golubchik [ 2022-11-20 ]

https://mariadb.com/kb/en/bit-functions-and-operators/

Generated at Thu Feb 08 10:13:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.