Commit Graph

16 Commits

Author SHA1 Message Date
Jean Pierre Dudey 9cdc75a930 Forbid exponents larger than 18.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-22 14:00:30 -04:00
Jean Pierre Dudey 6902bf826c Fix negative symbol bug in `FromStr` display implementation.
The negative symbol wasn't there when `int_part` was equal to zero.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-22 11:26:05 -04:00
Jean Pierre Dudey a915bc194d Fix multiplication logic in decimal parsing functions.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-22 07:22:47 -04:00
Jean Pierre Dudey e48e559740 Fix `UDecimal::parse_udecimal` identation.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-21 21:31:02 -04:00
Jean Pierre Dudey 455bc66d3c Fix parsing for numbers that are too big to fit in a `Decimal`/`UDecimal`.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-21 21:29:07 -04:00
Jean Pierre Dudey 07838568f9 Implement `FromStr` for `Decimal`/`UDecimal`.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-21 16:13:58 -04:00
Jean Pierre Dudey 1b4aba1d80 Update serde to 1.0 and strason to 0.4
The `serde_struct_impl!` macro has been modified to be compatible
with the serde 1.0 crate, we use this macro and not the `serde_derive`
crate because the latter doesn't support Rust 1.14.0 which is shipped
on Debian stable and we should remain compatible with it.

Two new features were added:

- "serde": enables serialization/deserialization for common types, it pulls
the serde 1.0 dependency.
- "serde-decimal": enables serialization/deserialization for `UDecimal`/`Decimal`,
this pulls the strason 0.4 depdendency and the serde 1.0 dependency.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 13:42:34 -04:00
Jean Pierre Dudey b2594087db Use the `?` (try) instead of the `try!` macro.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-12 12:47:31 -04:00
Jean Pierre Dudey 77c185d9ec Fix modules documentation title.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-08 17:38:50 -04:00
Andrew Poelstra 45ef239a34 Add unsigned Decimal type 2015-12-19 20:13:59 -06:00
Andrew Poelstra 1bbd492da6 Add nonnegative() utility function to Decimal 2015-11-30 14:23:15 -06:00
Andrew Poelstra 2962eb9d44 Add Display impl for Decimal 2015-11-30 14:08:45 -06:00
Andrew Poelstra a9cd31ccba Add addition and subtraction impls to Decimal 2015-11-30 14:03:57 -06:00
Andrew Poelstra 76729f33ca Fix `Decimal` serialization of negative numbers 2015-11-30 09:13:48 -06:00
Andrew Poelstra a8ffce4904 Fix Script de/serialization (version -> 0.4.4) 2015-11-30 07:11:24 -06:00
Andrew Poelstra e58f536c31 Add `Decimal` type for de/serializing values 2015-11-22 10:51:19 -06:00