The DelphiDabbler.Lib.Fractions.pas unit provides a single
"Advanced;" record, TFraction that encapsulates a
fraction and a number of operations on it.
A whole bunch of operator overloads make it straightforward to perform all the usual arithmetic operations on a fraction and to cast a TFraction to a from an integer or floating point value.
For full details of methods and operator overloads see the comprehensive online documentation. There is no help file.
DUnit tests for TFraction are included in the download.
This unit requires Delphi 2009 as a minimum and has been tested on all 32 bit Windows compilers from Delphi 2009 to Delphi XE4 and 64 bit Windows compilers from Delphi XE2 to XE4.
The Fractions Unit, documentation and test suite are supplied in a zip file. Before installing you need to extract all the files from the zip file, preserving the directory structure. The following files will be extracted:
DelphiDabbler.Lib.Fractions.pas – Main
source code.
ReadMe.htm – The unit's read-me file.
MPL-2.txt – Mozilla Public License v2.0.
ChangeLog.txt – The project's change log.
Documentation.URL – Short-cut to the online
documentation.
In addition to the above files you will find the DUnit tests in the
Test sub-directory.
There are three possible ways to use the unit.
DelphiDabbler.Lib.Fractions.pas to
your projects as you need it.
A complete change log is provided in the file ChangeLog.txt.
The Fractions Unit (DelphiDabbler.Lib.Fractions.pas) is
released under the terms of the Mozilla Public License v2.0.
All relevant trademarks are acknowledged.
Bugs can be reported or new features requested via the Issue Tracker.
If no similar report or request has been recorded already, use the New
Issue link to add a new issue. Please select the most appropriate
template from the Templates drop down list and change the
Project-unspecified label to Project-fractions.
I'm Peter Johnson – a hobbyist programmer living in Ceredigion in West Wales, UK, writing write mainly in Delphi. My programs and code are available from: http://www.delphidabbler.com/.
I can be contacted via the website.