File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1890,7 +1890,26 @@ extension BinaryFloatingPoint {
18901890 /// - Parameter value: A floating-point value to be converted.
18911891 @inlinable
18921892 public init < Source: BinaryFloatingPoint > ( _ value: Source ) {
1893- self = Self . _convert ( from: value) . value
1893+ #if !os(macOS) && !(os(iOS) && targetEnvironment(macCatalyst))
1894+ if #available( iOS 14 . 0 , watchOS 7 . 0 , tvOS 14 . 0 , * ) {
1895+ if case let value_ as Float16 = value {
1896+ self = Self ( Float ( value_) )
1897+ return
1898+ }
1899+ }
1900+ #endif
1901+ switch value {
1902+ case let value_ as Float :
1903+ self = Self ( value_)
1904+ case let value_ as Double :
1905+ self = Self ( value_)
1906+ #if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
1907+ case let value_ as Float80 :
1908+ self = Self ( value_)
1909+ #endif
1910+ default :
1911+ self = Self . _convert ( from: value) . value
1912+ }
18941913 }
18951914
18961915 /// Creates a new instance from the given value, if it can be represented
You can’t perform that action at this time.
0 commit comments