Skip to content

Commit

Permalink
Better README formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanday committed Oct 29, 2018
1 parent 33113b5 commit b4c34bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,21 @@ print(sub)
```swift
let a = Rational(1,2);
let b = Rational(3,6);

print(a==b)
// true

print(a<b)
// false
```
### Getting the numerator and denominator of a Rational numbers

```swift
let a = Rational(12,18);

print(a.numerator)
// 2

print(a.denominator)
// 3
```
Expand All @@ -82,6 +86,7 @@ print(a.denominator)
let a = Rational( 0.251, maxDenominator: 16 );
print(a)
// 1/4

let b = Rational( 0.251, maxDenominator: 256 )
print(a)
// 63/251
Expand All @@ -91,17 +96,20 @@ print(a)

```swift
let a = Rational( 3,2 );

let d = Double(a);
print(d)
// 1.5

let i = Int(a);
print(i)
// 1

let s = String(a);
print(s)
// "3/2"
```

## License

This project is licensed under the MIT License
This project is licensed under the MIT-style license, see source files

0 comments on commit b4c34bb

Please sign in to comment.