A C++ Fraction library.
The Fraction Library allows you to work with fractions (both improper and mixed) the same way integers are handled in C++. Perform arithmetic, comparison operations, I/O and others.
My name is Rafat Rashid. You can find more information about me at my website: http://individual.utoronto.ca/rafatrashid.
Installation is simple. Download the library and then unzip all the files into anywhere in your computer. However, do not change the directory hierarchy already set up.
The library was compiled using Microsoft Visual C++ 2010. If you are using some other IDE, such as Eclipse, Borland, XCode or even Linux and its Terminal, you may have to do some minor tweaking. For instance, create your own projects, include the appropriate source files and compile it. It is nothing an intermediate programmer can't handle.
In short, if you have a C++ compiler and have some experience in C/C++, you should be able to compile the library, regardless of the environment. If you are having trouble, shoot me an email.
Since I worked with all the IDEs and platforms mentioned above, I may include a step-by-step guide explaining what to do in each scenario at a later date.
Skip this section if you will link the source files into your code base using a method of your own choosing.
The .lib (static library) files are located in the /lib directory. There are two versions, the one in "Debug" subdirectory and the other in "Release". Debug sets macros such as _DEBUG and other details that aid in debugging and testing your code. The Release version is the optimized version. Link one of these libraries into your own project to be able to use the Fraction Library. See the example projects in the /tests directory if you are unsure how to do this (see project properties).
The idea of creating a class to handle and manipulate fractions began in grade 12 in high school. I have found I learn by doing and besides, I enjoy programming. So on the summer of 2009, I thought I would pick up where I left off (I had to actually start from scratch as I no longer had the code I had written previously). Landing a job at UofT was also part of the motivation.
Version 1.0 and the predecessor of V.1.1 was released on June 28, 2009.
You can thank Johan Halmen (who contacted me a few months ago with some improvements I can make) for V.1.1.
In developing the Fraction Library, I utilized and built on a lot of tools I learned during my second year in university, including the use of Doxygen to document my code.
General comments and any suggestions on improvements I can make is also appreciated.
Thanks goes out to:
Special thanks goes out to Johan Halmen for suggesting the Fraction::getGCD() algorithm. It's much better than what I had earlier.
The library is protected under the MIT license. For more information: http://opensource.org/licenses/MIT.
Released August 1, 2014
Released March 25, 2011
Released June 28, 2010