swiftprecisionquadruple-precision

How can I get Quadruple precision in Swift?


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?


Solution

  • Try swift-bignum.

    From their docs:

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