[swift-dev] Why are BinaryFloatingPoint's RawSignificand and RawExponent different type?

Stephen Canon scanon at apple.com
Fri Aug 26 18:02:54 CDT 2016


> On Aug 26, 2016, at 6:06 PM, Jens Persson via swift-dev <swift-dev at swift.org> wrote:
> 
> I can understand why
> Double.RawSignificand is UInt64
> and
> Float.RawSignificand is UInt32
> 
> But I can't understand why both
> Double.RawExponent
> and
> Float.RawExponent
> should be UInt.
> 
> Why aren't they also just UInt64 and UInt32, resp.?

Let me flip the question: why would they be UInt64 and UInt32?  Absent a reason to prefer a specific fixed-with type, Swift integers should generally default to being [U]Int (and ideally Int, but RawExponent is Unsigned).

– Steve


More information about the swift-dev mailing list