Skip to content

Swift wrapper for Gnu Multiple Precision Library

Notifications You must be signed in to change notification settings

twodayslate/SwiftGMP

 
 

Repository files navigation

Swift wrapper for the GNU Multiple Precision Arithmetic Library.

This project is a work in progress. Currently integer and some floating-point functions are implemented.

Install

Requirements

Currently libgmp.a 6.0.0a is included. You can rebuild it using the GMP iOS Builder.

Carthage

Add the following to your Cartfile:

 github "NeoTeo/SwiftGMP"

Then, in the root of your project, type: carthage update

You will then need to add frameworks to your own Xcode project:
  1. Select your target's Build Phases tab.
  2. Select the Link Binary With Libraries, click the + and then Add Other... buttons.
  3. Navigate to the Carthage/Build/Mac directory in your project root and select the SwiftGMP.framework.
    In case of a code signing error, select the target's Build Settings tab make sure the "Code Signing Identity" is either a valid identity or "Don't Code Sign".

For more information on how to install via Carthage see the README.

Swift 2+

For Swift 3 builds you may have to modify your xcode location. You can do this by running sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer/ or setting it from Xcode -> Preferences -> Locations -> Commmand Line Tools

Usage

A full set of examples can be found in our test suite.

import SwiftGMP

let s2d = SwiftGMP.GMPDouble("12356789123456789.9876")
let d2d = SwiftGMP.GMPDouble(12345.678)
print(String(s2d + d2d))

Example projects

Contribute

Contributions are welcome! Check out the issues.

License

GMP follows the GNU LGPL v3 and GNU GPL v2 licenses. This project has an additional MIT license.

About

Swift wrapper for Gnu Multiple Precision Library

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 90.9%
  • Swift 9.1%