SpilledMango
SpilledMango

Reputation: 615

Long Double in Swift

In C, there is a type called long double, which on my machine is 16-bytes (128-bit). Is there any way to store a long double in Swift? I've tried type aliases (typedefs) of long double from an Objective-C header, but it doesn't show up in Swift. And functions returning long double (powl, sqrtl) don't show up neither.

I know there's a Float80 but that's only 80 bits, not 128 bits.

Upvotes: 1

Views: 2036

Answers (1)

gnasher729
gnasher729

Reputation: 52538

Unless you have a POWER processor, your 128 bit long double is actually an 80 bits extended precision number, plus 48 bit wasted.

Upvotes: 4

Related Questions