Email or username:

Password:

Forgot your password?
Devil Lu Linvega

Today, @d6 wrote an excellent little guide on how to use negative numbers, aka signed numbers, in #uxn because it's a recurring question on IRC.

The guide also includes implementations of most logical and arithmetic operations.
wiki.xxiivv.com/site/uxntal_si

4 comments
πŸ‡ΊπŸ‡¦ haxadecimal

@neauoire @d6 The unsigned decimal values given for 0xfd through 0xff in the figure you attached are incorrect (one higher than they should be), though the signed values shown for those same hexadecimal values are correct.
In an n-bit binary representation, a two's complement negative value (MSB set) is equal to the unsigned value minus 2^n, so in an 8-bit two's complement number, 0xff is unsigned 255 , and signed is 255 - 256 = -1.

Devil Lu Linvega

@brouhaha @d6 Oh! right, of course. Thanks for catching that :) Fixed

:luz_cat_ears: meow meow

@neauoire @d6 has anyone done floats? I wanted to do something like that but I was busy

dok

@neauoire @d6 that's the same as two's complement

Go Up