First, a general +1 to these, thanks for proposing them.

In SE-0067 we spelled these “exactly” rather than “exact”.
init?<Source: Integer>(exactly value: Source)

As for –0, Int(exactly: -0.0) should *not* fail.  My rationale for this is as 
follows:

- While information (the signbit) is lost, the essential property is that 
`Double(Int(exactly: -0.0)) == -0.0`.
- If we instead adopted “no information loss” as a criteria, we would back 
ourselves into a corner w.r.t decimal floating-point types, which have multiple 
representations of most values (1.0 can be encoded as 1e0 or 10e-1 or 100e-2 
…).  The result would be that these initializers would always fail for decimal 
fp inputs.

– Steve
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to