- Bump
intl
to 0.20.0,lints
to 5.0.0 - Bump SDK to 3.3.0 (enables wasm)
- Fix #107: avoid exception when formatting decimal with
NumberFormat.compact()
.
- Throw
FormatException
onformatter.parse('NaN')
.
- Add
DecimalFormatter
to deal with intl package. Your can now parse and format decimals. - Add a dependency to intl.
- Update files according to license.
- Update license file to be recognized by pub.dev.
- (Breaking change) Fix
Decimal.pow
return type. This method now returns aRational
because3.pow(-1)
(similar to1/3
) could not be represented as aDecimal
. - Allow
Rational.toDecimal()
customization via its newtoBigInt
parameter.
- Fix toStringAsExponential returns INFINITY by implementing
toStringAsExponential
without relying on double implementation. - Fix issue to have
zero.precision == 1
.
The goal of this version is to have sharper types on the API and to avoid having [Decimal] objects that are not decimal numbers (1/3
for instance).
It introduces several breaking changes.
~/
now returns aBigInt
. If you need aDecimal
you can convert theBigInt
toDecimal
withbigint.toDecimal()
.- Removal of
isNaN
getter. It was always returningfalse
. - Removal of
isInfinite
getter. It was always returningfalse
. - Removal of
isNegative
getter. You can replace it withdecimal < Decimal.zero
. inverse
,/
now return aRational
. If you need aDecimal
you can convert theRational
toDecimal
withrational.toDecimal(scaleOnInfinitePrecision: xxx)
. If you need to make several computations where inverses or divisions are involved you should make thoses operations onRational
type to avoid loosing precision and at the end convert the result back toDecimal
if you want to display the result in a decimal form.
Other changes:
round()
,floor()
,ceil()
,truncate()
now accept an optionalscale
to indicate at which digit the operation should be done.- Add
shift
to move the decimal point. - Add extension method
hasFinitePrecision
onRational
to know if a decimal form of the rational is possible without loosing precision. - Add extension method
toDecimal()
onRational
. - Add extension method
toDecimal()
onint
. - Add extension method
toDecimal()
onBigInt
.
- Support json serialization as String with
Decimal.fromJson
/Decimal.toJson
.
- Add
Decimal.ten
. - Add
Decimal.toBigInt
.
- Add
Decimal.fromBigInt
.
- Add
DecimalIntl
to allow formatting with intl package.
- Allow negative value as exponent of
pow
.
- Fix typo in the description of the package.
- Stable null safety release.
- Migrate to nullsafety.
- add
Decimal.zero
andDecimal.one
. - add
Decimal.inverse
.
- add
Decimal.tryParse
.
- migration to Dart 2.
- make
Decimal.parse
a factory constructor.
- allow parsing of
1.
- move to Dart SDK 2.0
- make package strong clean
- add
Decimal.signum
- add
Decimal.hasFinitePrecision
- add
Decimal.precision
- add
Decimal.scale
- Stable: All even numbered minor versions are considered API stable: i.e.: v1.0.x, v1.2.x, and so on.
- Development: All odd numbered minor versions are considered API unstable: i.e.: v0.9.x, v1.1.x, and so on.