Interval Arithmetic in Swift with Interval Type
import Interval // needed only if you "make repl"
let about1 = 1.0 ± 0.1 // 0.9...1.1
about1+about1 // 1.8...2.2
about1-about1 // -0.2...0.2
about1*about1 // 0.81...1.21
about1/about1 // 0.818181818181818...1.22222222222222Swift 5.0 or better, OS X or Linux.
Just add interval.swift to it.
Have fun with Interval.playground that is a part of this git repo.
When you use it, make sure you turn on the left pane (it's off right after you pulled since UI settings are .gitignored). As you see above, this playground consists of multiple pages and sources.
Just drop interval.swift to Sources. In git Interval.playground/Sources/interval.swift is a symlink thereto.
git clone https://github.com/dankogai/swift-interval.git
cd swift-interval
make replgit clone https://github.com/dankogai/swift-interval.git
cd swift-interval
make SWIFTPATH=${YOUR_SWIFT_PATH} repl # ${YOUR_SWIFT_PATH}=~/swift/usr/bin in my caseSwift 5 or better, OS X or Linux to build.
