# Crate decimate [−] [src]

Simple implementation of decimal floating point numbers in pure rust.

Numbers are represented as significand and exponent. Significand is stored in an integer that is specified as type parameter, so basic operations should be reasonably fast.

When a limited integer type is used for significand then nearly all operations may cause integer overflows. Overflows are handled in the same way as with standard integer types: debug builds panic, release builds silently ignore them.

The main use case for this library is fast, low-overhead operations with financial data when precision and magnitude of numbers are well known beforehand and there is need for inexact conversions into ints and standard floating types for faster number-crunching.

This library implements non-standard precision handling. Decimals behave
mostly as fixed-point numbers. Unary operations `-`

and `abs`

don't alter
precision (number of decimal digits in the fractional part). Operations `+`

,
`-`

, `/`

, `%`

don't change precision either if precision of both operands
is the same. If it's not, then highest one is used
(e.g. `12.3 + 11.111 == 23.411`

).

Multiplication is the only exception: precision of result is sum of
precisions of operands (e.g. `123.4 * 0.2 == 24.68`

).

## Structs

Decimal | |

ParseDecimalError |

## Enums

DecimalFromStrRadixErr |

## Type Definitions

Exp |