Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Merge pull request #4 from yych42/master
Browse files Browse the repository at this point in the history
Migrate to null safety
  • Loading branch information
zlumyo committed Dec 14, 2021
2 parents 86f6b23 + c65abb3 commit 45db032
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 27 deletions.
16 changes: 0 additions & 16 deletions lib/src/euclid.dart
Expand Up @@ -179,10 +179,6 @@ int greatestCommonDivisor(int a, int b) => a.gcd(b);

/// Returns the greatest common divisor (gcd) of two integers using Euclid's algorithm.
int greatestCommonDivisorOfMany(List<int> integers) {
if (null == integers) {
throw ArgumentError.notNull('integers');
}

if (integers.length == 0) {
return 0;
}
Expand All @@ -207,10 +203,6 @@ int leastCommonMultiple(int a, int b) {

/// Returns the least common multiple (lcm) of many [BigInt] using Euclid's algorithm.
int leastCommonMultipleOfMany(List<int> integers) {
if (null == integers) {
throw ArgumentError.notNull('integers');
}

if (integers.length == 0) {
return 1;
}
Expand All @@ -229,10 +221,6 @@ BigInt greatestCommonDivisorBig(BigInt a, BigInt b) => a.gcd(b);

/// Returns the greatest common divisor (gcd) of many [BigInt] using Euclid's algorithm.
BigInt greatestCommonDivisorOfManyBig(List<BigInt> integers) {
if (null == integers) {
throw ArgumentError.notNull('integers');
}

if (integers.length == 0) {
return BigInt.zero;
}
Expand All @@ -257,10 +245,6 @@ BigInt leastCommonMultipleBig(BigInt a, BigInt b) {

/// Returns the least common multiple (lcm) of many [BigInt] using Euclid's algorithm.
BigInt leastCommonMultipleOfManyBig(List<BigInt> integers) {
if (null == integers) {
throw ArgumentError.notNull('integers');
}

if (integers.length == 0) {
return BigInt.one;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/precision.dart
Expand Up @@ -25,7 +25,7 @@ const int doubleWidth = 53;
/// double-precision floating numbers (64 bit).
///
/// According to the definition of Prof. Demmel and used in LAPACK and Scilab.
final double doublePrecision = pow(2, -doubleWidth);
final double doublePrecision = pow(2, -doubleWidth) as double;

/// Standard epsilon, the maximum relative precision of IEEE 754
/// double-precision floating numbers (64 bit).
Expand Down
4 changes: 0 additions & 4 deletions lib/src/special_functions/factorial.dart
Expand Up @@ -94,10 +94,6 @@ double multinomial(int n, List<int> ni) {
throw ArgumentError.value(n, 'n', messages.argumentPositive);
}

if (ni == null) {
throw ArgumentError.notNull('ni');
}

int sum = 0;
double ret = factorialLn(n);
for (int i = 0; i < ni.length; i++) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/utils.dart
Expand Up @@ -11,8 +11,8 @@ double log10(num x) => log(x) / ln10;

Tuple2<List<TU>, List<TV>> unpackSinglePass<TU, TV>(
Iterable<Tuple2<TU, TV>> samples) {
var u = new List<TU>();
var v = new List<TV>();
var u = <TU>[];
var v = <TV>[];

for (var tuple in samples) {
u.add(tuple.item1);
Expand Down
7 changes: 3 additions & 4 deletions pubspec.yaml
Expand Up @@ -2,13 +2,12 @@ name: dart_numerics
description: An ultimate numerical package for Dart for professional and every day use.
version: 0.0.5
homepage: https://github.com/zlumyo/dart_numerics
author: Vladimir Ivanov <zlumyo@gmail.com>

environment:
sdk: '>=2.0.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
tuple: ^1.0.2
tuple: ^2.0.0

dev_dependencies:
test: ^1.0.0
test: ^1.19.4

0 comments on commit 45db032

Please sign in to comment.