Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

Fractions Unit Overview

Applies to: ~>0.1

This page provides an overview of the features of the Fractions Unit. If you are looking for information on programming with the unit please see the Programmers’ Guide.

This unit contains an encapsulation of a fraction and arthrithmetic performed on it.

A single advanced record type, TFraction, is used to encapsulate the fraction. Instances of the record are immutable, i.e. their properties cannot be altered once the instance has been constructed. All methods that manipulate properties create new instances containing the results.

Operator overloading is used extensively to enable normal arithmetic operations to be carried out on fractions.

⚠️ The current code is beta, although it has been stable for some time. The interface is liable to change. If any bugs are noticed, please report them via the issue tracker on GitHub (GitHub account required).

Compatibility

This unit is designed for compilation with 32 bit and 64 bit Windows Delphi compilers. It is designed to compile with compilers from Delphi 2009 onwards.

The code uses only Delphi RTL libraries and so should be able to compile for any platform supported by Delphi.

The unit is compatible with both VCL and FMX applications.

Unit Tests

Unit tests that exercise each method and property are available in the GitHub repository.

Example Code

The documentation of each method and property contains brief examples of use.