bignum 0.1.0

  • README.md
  • changelog.md
  • Installing
  • Versions
  • 42

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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

Analysis

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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
80 / 100
Health:
Code health derived from static analysis. [more]
7 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
42
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:bignum/bignum.dart.

Suggestions

  • Package is too old.

    The package was released more than two years ago.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 53 errors 18 hints.

    Strong-mode analysis of lib/src/big_integer_dartvm.dart failed with the following error:

    line: 777 col: 3
    Invalid override. The type of 'BigIntegerDartvm./' ('(BigIntegerDartvm) → BigIntegerDartvm') isn't a subtype of 'BigInteger./' ('(dynamic) → BigInteger').

    Strong-mode analysis of lib/src/big_integer_v8.dart failed with the following error:

    line: 1636 col: 3
    Invalid override. The type of 'BigIntegerV8.|' ('(BigIntegerV8) → BigIntegerV8') isn't a subtype of 'BigInteger.|' ('(dynamic) → BigInteger').

    Similar analysis of the following files failed:

    • lib/bignum.dart (hint)
    • lib/src/null_exp.dart (hint)
  • The description is too short.

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

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • 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.

Dependencies

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