How can I get Quadruple precision in Swift?

161 Views Asked by At

I have a project I would like to do in Swift, but I need 32 digit precision for my floating point arithmetic and properties. Can anyone tell me what would be the simplest way to get quad precision in Swift?

1

There are 1 best solutions below

6
On BEST ANSWER

Try swift-bignum.

From their docs:

import BigNum

BigRat.sqrt(2, precision: 128)  // 240615969168004511545033772477625056927/170141183460469231731687303715884105728
BigFloat.exp(1, precision: 128) // 2.718281828459045235360287471352662497759