Account for floating point exactly conversions and disable some tests that are caused by SR-4634

This commit is contained in:
Philippe Hausler
2017-04-20 13:34:04 -07:00
parent d26970e77a
commit fa39edf6a0
2 changed files with 17 additions and 15 deletions

View File

@@ -434,15 +434,9 @@ extension Float : _ObjectiveCBridgeable {
}
public init?(exactly number: NSNumber) {
let value = number.doubleValue
if value.isNaN {
self = Float.nan
} else if value.isInfinite {
self = value.sign == .plus ? Float.infinity : -Float.infinity
} else {
guard Double(-Float.greatestFiniteMagnitude) <= value || value <= Double(Float.greatestFiniteMagnitude) else { return nil }
self = Float(value)
}
guard let value = Double(exactly: number) else { return nil }
guard let result = Float(exactly: value) else { return nil }
self = result
}
@_semantics("convertToObjectiveC")