You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-5326 Decimal(string:locale:) doesn't fail when the entire string isn't parsable
Issue Description:
Decimal(string:locale) produces different results on macOS vs Linux. On macOS, it expects a localized decimal separator in the supplied string, whereas on Linux it expects the decimal separator to be "."
Steps to reproduce
importFoundationleten_US = Locale(identifier: "en_US")
letfr_FR = Locale(identifier: "fr_FR")
vars = "1234.5678"print("\(s) with en_US: \(Decimal(string: s, locale: en_US))")
print("\(s) with fr_FR: \(Decimal(string: s, locale: fr_FR))")
s = "1234,5678"print("\(s) with en_US: \(Decimal(string: s, locale: en_US))")
print("\(s) with fr_FR: \(Decimal(string: s, locale: fr_FR))")
The API doc does not specify which behavior is correct. However, in my opinion, the macOS output is more correct since the initializer has a Locale parameter.
Environment
Linux
Ubuntu 18.04 server
Swift version 5.0 (swift-5.0-RELEASE) Target: x86_64-unknown-linux-gnu
macOS
macOS 10.14.4
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3) Target: x86_64-apple-darwin18.5.0
The text was updated successfully, but these errors were encountered:
Environment
Swift version 5.0 (swift-5.0-RELEASE) Target: x86_64-unknown-linux-gnu on Ubuntu 18.04 Server
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3) Target: x86_64-apple-darwin18.5.0 on macOS 10.14.4
Additional Detail from JIRA
md5: 273a3e1b9d3ab06690912aaf916a086f
relates to:
Issue Description:
Decimal(string:locale)
produces different results on macOS vs Linux. On macOS, it expects a localized decimal separator in the supplied string, whereas on Linux it expects the decimal separator to be ".
"Steps to reproduce
Output on macOS
Output on Linux
The API doc does not specify which behavior is correct. However, in my opinion, the macOS output is more correct since the initializer has a Locale parameter.
Environment
Linux
Ubuntu 18.04 server
Swift version 5.0 (swift-5.0-RELEASE) Target: x86_64-unknown-linux-gnu
macOS
macOS 10.14.4
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3) Target: x86_64-apple-darwin18.5.0
The text was updated successfully, but these errors were encountered: