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
// digit
if let digitType = type as? DigitValue.Type {
// 大 Int 数据解析永远是 18035768958676992
// let x = 18035768958676993, // 解析失败, 解析结果成 18035768958676992
// let y = 18035768958676992 // 解析成功
return Double("\(decimal)")
.flatMap { NSNumber(value: $0) }
.flatMap { digitType.init(truncating: $0) }
}
// decimal number
if type is NSDecimalNumber.Type {
return NSDecimalNumber(decimal: decimal)
}
// decimal
if type is Decimal.Type { return decimal }
// other
return Double("\(decimal)").flatMap { NSNumber(value: $0) }
}
`
The text was updated successfully, but these errors were encountered:
` static func number( value: Any, _ type: Any.Type) -> NumberValue? {
guard let str = _numberString(value) else { return nil }
guard let decimal = Decimal(string: str) else { return nil }
`
The text was updated successfully, but these errors were encountered: