CD4017BE / RedstoneControl

AutomatedRedstone mod remake: this time more awesome with point to point wires and less complicated GUIs
MIT License
17 stars 8 forks source link

7 Segment display lacks negative sign element. #35

Closed NoxyNixie closed 4 years ago

NoxyNixie commented 4 years ago

As you can see in the image below the negative number appears quite positive on the 7 segment display:

image

With all the number being signed 32bit values I think the 7 segment display should have a negative sign element showing up with negative numbers.

Awesome mod and thanks for all the work ;)

EDIT: I discovered the signed decimal encoding option but that seems even less useful:

image

CD4017BE commented 4 years ago

The unsigned decimal encoding (default) displays the 4 four least significant digits and ignores the sign as well as all higher digits. But it outputs the value divided by 10 000 so those can be displayed on another display to the left *. The signed decimal encoding can only display numbers in range -1999 ... +1999. Numbers outside that range will display as overflow +1 or underflow -1. To display large signed numbers, the leftmost display (last in the chain) should be signed and all the other ones unsigned.

*: In case the number is negative and rounds up to 0 after division by 10 000, it actually emits as -2^31 which is used to represent negative zero so the last (signed) display in the chain will correctly show the negative sign.

NoxyNixie commented 4 years ago

Ah wow ... alright that works but that wasn't super obvious (I also think its undocumented). Wouldn't it be an idea to make the default mode support sign out of the box?

Thanks ;)

CD4017BE commented 4 years ago

I could swap the signed one to be default and name the unsigned one "extender" instead. The problem is that these displays need to behave in a way that they show correctly without having any way of knowing, where they are placed within a potential chain of displays so options for versatility are a bit limited.