Language…
22 users online: Aurel509, buggy789, Chambo, codfish1002, cohimbra, Dennsen86, Dispace, Fozymandias, Gamet2004, Golden Yoshi, Green, Green Jerry, LightAligns, mio, Mischievous Marc, neidoodle, Raychu2021, RicardoDeMelo, RZRider, sinseiga, synthie_cat, tOaO - Guests: 301 - Bots: 283
Users: 64,795 (2,375 active)
Latest user: mathew

is this a windows calculator glitch?

Tested on windows 10.

1) Click on a button that has 3 lines on the top-left, and select "Programmer".

2) Set the size to BYTE (which limits you to 8-bits or 2 hex digits)

3) Set mode to binary, and type in "10000000", it should be -128 in decimal

4) Press Rsh (stands for right shift) and then type 1 to shift the binary by 1 digit to the right. Notice that it turns from 10000000 into 11000000 instead of 01000000. I have realized that after testing multiple numbers, if bit 7 (leftmost bit) of a byte is set, right shifting it causes set bits to enter from the left. Is this intentional? Does this happens on 65c816 ASM too?
Give thanks to RPG hacker for working on Asar.
That's arithmetic or sign-extended shift. Computers tend to use bit shift to do fast division (right shift) or multiplication (left shift) by two, but normal right shifting fails with negative numbers because you shift the sign bit down, turning the number positive again.

Right-shifting on a signed integer in Windows Calculator will fill any new bits with the value of the sign bit to preserve whether the number is negative or positive.

Celarix | smlimitless@github | Avatar by Uhrix