No description
Find a file
2015-02-18 23:52:56 -05:00
src Refactored the tests a bit 2015-02-16 21:06:49 -05:00
tests Refactored the tests a bit 2015-02-16 21:06:49 -05:00
.gitignore Add gitignore file 2015-02-16 18:12:24 -05:00
.travis.yml Fixed some Travis CI stuff 2015-02-18 23:52:56 -05:00
circle.yml Hopefully fixed CircleCI 2015-02-15 14:16:29 -05:00
LICENSE Refined some functions and added some basic operations 2015-02-15 15:57:13 -05:00
nimrat.nimble Removed some unnecessary stuff from nimble file 2015-02-15 15:16:51 -05:00
README.md Fixed some Travis CI stuff 2015-02-18 23:52:56 -05:00

nimrat Build Status Build Status

<:3)~~

This module implements some very basic rational arithmetic in Nim.

Example:

import nimrat

var 
  myFrac: Rational = (3,4) # the fraction 3/4
  myFrac2: Rational = (7,8) # the fraction 7/8
    
echo myFrac + myFrac2
# Prints "13 / 8"
echo myFrac * myFrac2
# Prints "21 / 32"
echo myFrac / myFrac2
# Prints "6 / 7"
echo simple((33,44)) # reduced form of a given fraction
# Prints "3 / 4"
# Note, to actually simplify, do:
var unSimple = (4,8)
unSimple.simplify # actually modifies the rational
echo unSimple
# Prints (1,2)