SwiftDecimalNumber 1.0.3

SwiftDecimalNumber 1.0.3

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2016
SPMSupports SPM

Maintained by Stuart Wakefield.



  • By
  • Stuart Wakefield

SwiftDecimalNumber

Arithmetic operators for decimal numbers

By Stuart Wakefield

Introduction

Provides extensions to NSDecimalNumber to support arithmetic operations:

let a = NSDecimalNumber(string: "0.4")
let b = NSDecimalNumber(string: "10")
let c = a * b

API

Comparisons

a == b

Compares the NSDecimalNumber instances a and b returning true if both are equal and false otherwise. See NSDecimalNumber.compare(_:) for underlying implementation details, will return true if result is NSComparisonResult.OrderedSame.

a > b

a < b

a >= b

a <= b

Arithmetic

a + b

a - b

a * b

a / b

a ** b

Functions

min(a, b)

max(a, b)