oscbyspro / Ultimathnum

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

Generic binary float conversions #25

Open oscbyspro opened 2 weeks ago

oscbyspro commented 2 weeks ago

I don't yet plan on reworking binary floats, so I should just add some generic Swift.BinaryFloatingPoint methods.

oscbyspro commented 1 week ago

Hm. It's definitely possible to implement, but there are some annoyances that I want to take care of first. A) Interoperating with Swift.BinaryFloatingPoint's various associated Swift.BinaryInteger types is tedious. It is intentionally minimalistic and limited to concrete conversions. I could improve this by adding things like BinaryInteger.init(truncatingIfNeeded: some Swift.BinaryInteger), but where would such interoperability stop? Alternatively, I could add custom floating point types. B) I might want to rework how bit-shifting works and add generic smart and masked shifts. In that case, I might want to rework how sizes work too. At that point, I'm deep down another rabbit hole.