decimal 3.0.2 decimal: ^3.0.2 copied to clipboard
The decimal package allows you to deal with decimal numbers without losing precision.
3.0.2 (2024-06-09) #
- Fix #107: avoid exception when formatting decimal with
NumberFormat.compact()
.
3.0.1 (2024-06-04) #
- Throw
FormatException
onformatter.parse('NaN')
.
3.0.0 (2024-06-02) #
- Add
DecimalFormatter
to deal with intl package. Your can now parse and format decimals. - Add a dependency to intl.
2.3.3 (2023-07-08) #
2.3.2 (2022-12-07) #
- Update files according to license.
2.3.1 (2022-11-24) #
- Update license file to be recognized by pub.dev.
2.3.0 (2022-09-07) #
- (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.
2.2.0 (2022-04-19) #
2.1.0 (2021-12-22) #
- Fix toStringAsExponential returns INFINITY by implementing
toStringAsExponential
without relying on double implementation. - Fix issue to have
zero.precision == 1
.
2.0.1 (2021-12-20) #
2.0.0 (2021-11-29) #
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
.
1.5.0 (2021-11-17) #
- Support json serialization as String with
Decimal.fromJson
/Decimal.toJson
.
1.4.0 (2021-11-16) #
- Add
Decimal.ten
. - Add
Decimal.toBigInt
.
1.3.0 (2021-07-21) #
- Add
Decimal.fromBigInt
.
1.1.0 (2021-04-29) #
- Allow negative value as exponent of
pow
.
1.0.0+1 (2021-03-29) #
- Fix typo in the description of the package.
1.0.0 (2021-02-25) #
- Stable null safety release.
1.0.0-nullsafety (2020-11-27) #
- Migrate to nullsafety.
0.3.5 (2019-09-02) #
0.3.4 (2019-07-29) #
- add
Decimal.zero
andDecimal.one
. - add
Decimal.inverse
.
0.3.3 (2019-01-16) #
- add
Decimal.tryParse
.
0.3.2 (2018-07-24) #
- migration to Dart 2.
v0.3.1 (2018-07-10) #
- make
Decimal.parse
a factory constructor.
v0.3.0 (2018-07-10) #
- allow parsing of
1.
v0.2.0 (2018-04-15) #
- move to Dart SDK 2.0
v0.1.4 (2017-06-16) #
- make package strong clean
v0.1.3 (2014-10-29) #
- add
Decimal.signum
- add
Decimal.hasFinitePrecision
- add
Decimal.precision
- add
Decimal.scale
Semantic Version Conventions #
- 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.