- Improve performance by working around the issue BigInt.gcd() is really slow with a custom
gcd
implementation based on Euclidean algorithm.
- Update files according to license.
- Update license file to be recognized by pub.dev.
- Explicitly throw an
ArgumentError
when a Rational is created with a zero denominator.
- Add
Rational.tryParse
.
The goal of this version is to move several decimal methods back to the decimal package and to have sharper types on the API.
It introduces several breaking changes.
~/
,round()
,floor()
,ceil()
,truncate()
now return aBigInt
. If you need aRational
you can convert theBigInt
toRational
withbigint.toRational()
.- Removal of
toDecimalString()
. You can replace it withrational.toDecimal(scaleOnInfinitePrecision: 10).toString()
using the decimal package. - Removal of
isNaN
getter. It was always returningfalse
. - Removal of
isInfinite
getter. It was always returningfalse
. - Removal of
isNegative
getter. You can replace it withrational < Rational.zero
. - Removal of
roundToDouble()
,floorToDouble()
,ceilToDouble()
,truncateToDouble()
. You can replace them byround().toDouble()
,floor().toDouble()
,ceil().toDouble()
,truncate().toDouble()
. - Removal of
toInt()
. You can replace it withrational.toBigInt().toInt()
. - Removal of
hasFinitePrecision
getter. This getter (provided as extension onRational
) is now part of the decimal package. - Removal of
precision
andscale
getters. They was only available on rational returningtrue
onhasFinitePrecision
(ie. decimal numbers). You can replace them withrational.toDecimal().precision
andrational.toDecimal().scale
using the decimal package. - Removal of
toStringAsFixed
,toStringAsExponential
andtoStringAsPrecision
. You can replace them withrational.toDecimal(scaleOnInfinitePrecision: xxx).toStringAsFixed
,rational.toDecimal(scaleOnInfinitePrecision: xxx).toStringAsExponential
andrational.toDecimal(scaleOnInfinitePrecision: xxx).toStringAsPrecision
using the decimal package.
Other changes:
- Add extension method
toRational()
onint
. - Add extension method
toRational()
onBigInt
.
- Improve performance of several methods by working around the issue BigInt.gcd() is really slow with a custom
gcd
implementation based on Euclidean algorithm.
- Improve parsing of number with big exponent part. However the exponent part must now be parsable as an int.
- Fix the doc of
pow
.
- Allow negative value as exponent of
pow
.
- Stable null safety release.
- Migrate to nullsafety.
- Improve pub score.
- add
Rational.pow
.
- add
Rational.zero
andRational.one
. - add
Rational.inverse
.
- fix issue with
signnum
.
- migration to Dart 2.
- allow parsing of
1.
. - make
Rational.parse
a factory constructor.
- move to Dart SDK 2.0
- remove
BigInt
class - use
BigInt
provided bydart:core
- add types.
- fix bug on
operator %
with negative values on browser.
- fix a bug on
BigInt.toDouble
.
- fix a bug for
Rational.precision
on negative number.
- fix bugs with dart2js
- add
Rational.signum
- add
Rational.hasFinitePrecision
- add
Rational.precision
- add
Rational.scale
Rational.parse
accepts strings in scientific notation (eg.1.5e-3
).
BigInt.parse
accepts an optional prepending+
for positive integers.
- 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.