# FixedPointDecimals

Provides the fixed-point decimal type `FixedDecimal`

allowing for exact representations of
decimal numbers. These numbers are useful in financial calculations where interactions
between decimal numbers are required to be exact.

This library defines the type `FixedDecimal{T <: Integer, f}`

as a subtype of `Real`

. The
parameter `T`

is the underlying machine representation and `f`

is the number of decimal
places which can be stored.

For example, `FixedDecimal{Int8, 2}`

allows you to a decimal number with up to 2 fractional
digits. All `FixedDecimal{Int8, 2}`

numbers `x`

must satisfy

```
-1.28 = -128/10² ≤ x ≤ 127/10² = 1.27
```

because the range of `Int8`

is from -128 to 127.

In general `FixedDecimal{T <: Integer, f}`

numbers `y`

must satisfy:

```
typemin(T)/10ᶠ ≤ y ≤ typemax(T)/10ᶠ
```

## Usage

```
julia> using FixedPointDecimals
julia> 2.2 / 10
0.22000000000000003
julia> FixedDecimal{Int,2}(2.2) / 10
FixedDecimal{Int64,2}(0.22)
julia> 0.1 + 0.2
0.30000000000000004
julia> FixedDecimal{Int,1}(0.1) + FixedDecimal{Int,1}(0.2)
FixedDecimal{Int64,1}(0.3)
```