oscbyspro / Ultimathnum

Binary arithmetic reimagined in Swift
Apache License 2.0
4 stars 1 forks source link

DataInt/isCompact #28

Closed oscbyspro closed 2 weeks ago

oscbyspro commented 2 weeks ago

Asking whether the last bit in the body extends the bit pattern is another useful query. It is not complicated, but it is quite wordy so it might deserves a name. It's currently simpler to go through DataInt/entropy(), which is obviously a roundabout way of doing it.

oscbyspro commented 2 weeks ago

Hm. I suspect that the inverse might be more appropriate. The implementation and behavior of DataInt/isExtended is much more similar to DataInt/isNormal. Both would perform an inequality check and return true when DataInt.Body/isEmpty.

oscbyspro commented 2 weeks ago

This is the moment when you wish computers worked at the bit level so you could reasonably use DataInt\<U1> and call DataInt/isNormal instead of introducing a new concept. Like, I could call it DataInt/isNormal(Bit.self) or something to that effect. Alternatively, I could add a bitwise view but I have done that twice and removed it twice already.

oscbyspro commented 2 weeks ago

Perhaps some conveniences is enough:

body.last?.msb != appendix