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

BIN_SHR on INT128 does not apply sign extension #7603

Closed
mrotteveel opened this issue May 24, 2023 · 2 comments
Closed

BIN_SHR on INT128 does not apply sign extension #7603

mrotteveel opened this issue May 24, 2023 · 2 comments

Comments

@mrotteveel
Copy link
Member

The BIN_SHR function applies sign extension on SMALLINT, INTEGER and BIGINT values, but doesn't do so on INT128.

For example:

select bin_shr(cast(-1 as bigint), 1) as for_bigint, bin_shr(cast(-1 as int128), 1) for_int128 
from rdb$database;

This returns

           FOR_BIGINT                                    FOR_INT128
===================== =============================================
                   -1       170141183460469231731687303715884105727

However, expected for FOR_INT128 would be -1 as well.

@mrotteveel
Copy link
Member Author

NOTE: 170141183460469231731687303715884105727 is 0x7fffffffffffffffffffffffffffffff, while expected is 0xffffffffffffffffffffffffffffffff

@pavel-zotov
Copy link

@@@ QA NOTE @@@
Test not needed. Issue is covered by one of examples in functional/datatypes/test_int128_binary_operations.py

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