bignum 0.1.0

  • README.md
  • changelog.md
  • Installing
  • Versions
  • 28

dart-bignum

Getting Started

Create a Dart project and add a pubspec.yaml file to it

pub.dartlang.org

dependencies:
  bignum: any

git

dependencies:
  bignum:
    git: git://github.com/Dartist/dart-bignum.git

and run pub install to install bignum (including its dependencies). Now add import

import 'package:bignum/bignum.dart';

Example

Code

import 'package:bignum/bignum.dart';
void main() {
  BigInteger x = new BigInteger("12341234123412341234");
  BigInteger y = new BigInteger("100");
  var z = x * y * x;
  print("base 10: z = ${z.toString()}");
  print("base 16: z = ${z.toString(16)}");
  print("base 2: z = ${z.toString(2)}");
}

Output

base 10: z = 15230605968887717854389148085725664275600
base 16: z = 2cc23c02bae6a6051a5ce673189c3a6c90
base 2: z = 10110011000010001111000000001010111010111001101010011000000101000110100101110011100110011100110001100010011100001110100110110010010000

Sample

Tobase. The sample currently has known issues with bitwise operators.

Caveats

Currently few known bugs exist while compiling from dart2js. One is working with bitwise operators, the internal implementation of shift operators with dart2js does not handle the same way as the VM. Most of this code was ported from v8 benchmark suite. Tom Wu is to thank for the core javascript implementation and the v8 team for optimizations on different javascript virtual machines.

Bugs & Testing

Please feel free to add issues on github issue tracker, we would like to provide a solid library for the community to use.

References

Changelog - dart-bignum

0.1.0 2015-02-03 (SDK 1.14.0)

  • Cleaned up interface
  • Hide platform-specific implementations
  • Removed unused legacy implementation

0.0.7 2015-06-29 (SDK 1.11.0)

  • Use native big integer when run in dartvm(>= 1.11.0)

0.0.6 2014-09-02 (SDK 1.6.0-dev.9.7 r39537)

  • Used Uint8List instead of List<int> for performance improvement.

0.0.5 2014-02-10 (SDK 1.2.0-dev.4.0 r32426)

  • Add a leading 0 to binary data in fromBytes() constructor if most significant bit set

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  bignum: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:bignum/bignum.dart';
  
Version Uploaded Documentation Archive
0.1.0 Feb 3, 2016 Go to the documentation of bignum 0.1.0 Download bignum 0.1.0 archive
0.0.7 Jun 30, 2015 Go to the documentation of bignum 0.0.7 Download bignum 0.0.7 archive
0.0.6 Sep 3, 2014 Go to the documentation of bignum 0.0.6 Download bignum 0.0.6 archive
0.0.5 Feb 19, 2014 Go to the documentation of bignum 0.0.5 Download bignum 0.0.5 archive
0.0.4 Jan 14, 2014 Go to the documentation of bignum 0.0.4 Download bignum 0.0.4 archive
0.0.3 Apr 27, 2013 Go to the documentation of bignum 0.0.3 Download bignum 0.0.3 archive
0.0.1 Sep 25, 2012 Go to the documentation of bignum 0.0.1 Download bignum 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
57
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
28
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms:

Low code quality prevents platform classification.

Health issues and suggestions

Fix lib/src/big_integer_dartvm.dart. (-99.96 points)

Analysis of lib/src/big_integer_dartvm.dart failed with 27 errors, 7 hints, including:

line 249 col 3: 'BigIntegerDartvm.copyTo' ('(BigIntegerDartvm) → void') isn't a valid override of 'BigInteger.copyTo' ('(dynamic) → void').

line 259 col 3: 'BigIntegerDartvm.fromString' ('(String, int) → void') isn't a valid override of 'BigInteger.fromString' ('(dynamic, int) → void').

line 349 col 3: 'BigIntegerDartvm.lShiftTo' ('(int, dynamic) → void') isn't a valid override of 'BigInteger.lShiftTo' ('(dynamic, dynamic) → void').

line 377 col 3: 'BigIntegerDartvm.divRemTo' ('(BigIntegerDartvm, BigIntegerDartvm, BigIntegerDartvm) → dynamic') isn't a valid override of 'BigInteger.divRemTo' ('(dynamic, dynamic, dynamic) → dynamic').

line 407 col 3: 'BigIntegerDartvm.modPowInt' ('(int, BigIntegerDartvm) → BigIntegerDartvm') isn't a valid override of 'BigInteger.modPowInt' ('(int, dynamic) → BigInteger').

Fix lib/src/big_integer_v8.dart. (-99.96 points)

Analysis of lib/src/big_integer_v8.dart failed with 27 errors, 5 hints, including:

line 455 col 3: 'BigIntegerV8.copyTo' ('(BigIntegerV8) → void') isn't a valid override of 'BigInteger.copyTo' ('(dynamic) → void').

line 786 col 3: 'BigIntegerV8.divRemTo' ('(BigIntegerV8, dynamic, BigIntegerV8) → dynamic') isn't a valid override of 'BigInteger.divRemTo' ('(dynamic, dynamic, dynamic) → dynamic').

line 909 col 3: 'BigIntegerV8.modPowInt' ('(int, BigIntegerV8) → BigIntegerV8') isn't a valid override of 'BigInteger.modPowInt' ('(int, dynamic) → BigInteger').

line 955 col 19: The getter 'LN2' isn't defined for the class 'Mathx'.

line 1098 col 3: 'BigIntegerV8.equals' ('(BigIntegerV8) → bool') isn't a valid override of 'BigInteger.equals' ('(dynamic) → bool').

Document public APIs (-10 points)

91 out of 91 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Fix lib/bignum.dart. (-0.50 points)

Analysis of lib/bignum.dart reported 1 hint:

line 18 col 5: Dead code.

Format lib/src/null_exp.dart.

Run dartfmt to format lib/src/null_exp.dart.

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Low code quality prevents platform classification.

Package is too old. (-100 points)

The package was released more than two years ago.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use bignum.dart. Packages with multiple examples should use example/readme.md.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.11.0
fixnum >=0.10.2 <0.11.0 0.10.9
Dev dependencies
unittest >=0.9.0 <0.10.0