oscbyspro / Ultimathnum

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

Add: Doublet.init(_:) #118

Closed oscbyspro closed 3 weeks ago

oscbyspro commented 3 weeks ago

For arbitrary integers to behave like systems integers, the appendix bit extension of unsigned integers must end at some point. In particular, it must end at bit Count.infinity. As such, the proper way of loading the high part of Doublet<T> is by repeating Bit(x.isNegative) rather than x.appendix, which is a bit finicky. Something, something, orders of infinity. It might, therefore, make sense to add Doublet.init(load:).

oscbyspro commented 3 weeks ago

The immediate application is the well-behaved 1-by-1-as-2 BinaryInteger/multiplication(_:) method.

oscbyspro commented 3 weeks ago

I had initially imagined that arbitrary unsigned integers would extend forever-and-ever in the same way that signed integers do, but this a greater unification. Innovation is in some ways similar to excavation.