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.

**Project:** Fractions

**Unit:** *DelphiDabbler.Lib.Fractions*

**Record:** *TFraction*

**Applies to:** ~>0.1

```
function HasCommonFactor(const Factor: Int64): Boolean;
```

This method checks if a given value is a common factor for the fraction. The value being queried is passed in the *Factor* parameter.

A common factor is an integer that exactly divides both the numerator and denominator of a fraction.

The method always returns False if *Factor* is zero.

*HasCommonFactor* is useful for checking that a value is a valid common factor before passing to *Simplify* method.

```
var
F: TFraction;
S: string;
CF: Int64;
begin
F := TFraction.Create(32, 48);
// get common factor from user
S := _;
if not InputQuery('HasCommonFactor', 'Enter a factor', S) then
Exit;
CF := StrToInt64Def(S, 0);
if F.HasCommonFactor(CF) then
ShowMessageFmt(
'%d is a common factor of %d/%d', [CF, F.Numerator, F.Denominator]
);
end;
```

*Simplify*method