numnums 1.0.0 copy "numnums: ^1.0.0" to clipboard
numnums: ^1.0.0 copied to clipboard

Helpful numeric types.

example/numnums_example.dart

import 'dart:math';

import 'package:numnums/numnums.dart';

final _rand = Random();
_randomInt() => _rand.nextInt(2^32);

void main() {
  final start = _randomInt();
  final end = _randomInt();
  var awesome = between(start, end);
  if (start < end) {
    print('$start $awesome $end');
  } else {
    print('$end $awesome $start');
  }

  final NaturalNumber n1 = NaturalNumber(_randomInt());
  final NaturalNumber n2 = NaturalNumber(_randomInt());
  print('$n1 $n2 nice features like GCD: ${n1.gcd(n2)} and LCM: ${n2.lcm(n1)}');

  final Fraction n3 = Fraction(n1.val, n2.val);
  print("$n3 can reduce to ${n3.reduce()} and flipped ${n3.reciprocal()}");
}
1
likes
140
points
25
downloads

Publisher

verified publishervisionary.software

Weekly Downloads

Helpful numeric types.

Repository

Documentation

API reference

License

GPL-3.0 (license)

More

Packages that depend on numnums