Avatar
指数部で3bit節約しても仮数部を10進38桁にするには全然ビット数が足りないな?
1:28 PM
https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/Decimal.swift fileprivate var __exponent: Int8 fileprivate var __lengthAndFlags: UInt8 fileprivate var __reserved: UInt16 public var _mantissa: (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16) 160bit
swift-corelibs-foundation - The Foundation Project, providing core utilities, internationalization, and OS independence
1:29 PM
import Foundation print(MemoryLayout<Decimal>.size) // 20
1:29 PM
20バイトですね。
1:29 PM
Decimal1個でFloat5個分のメモリ容量を取る。