decimal 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 91

Dart Decimals

Build Status

This project enable to make computations on decimal numbers without loosing precision like double operations.

For instance :

// with double
print(0.2 + 0.1); // displays 0.30000000000000004

// with decimal
print(Decimal.parse('0.2') + Decimal.parse('0.1')); // displays 0.3

Usage

To use this library in your code :

  • add a dependency in your pubspec.yaml :
dependencies:
  decimal: ^0.2.0
  • add import in your dart code :
import 'package:decimal/decimal.dart';
  • Start computing using Decimal.parse('1.23').

Hint : To make your code shorter you can define a shortcut for Decimal.parse :

final d = Decimal.parse;
d('0.2') + d('0.1'); // => 0.3

License

Apache 2.0

v0.2.0 (2018-04-15)

  • move to Dart SDK 2.0

v0.1.4 (2017-06-16)

  • make package strong clean

v0.1.3 (2014-10-29)

  • add Decimal.signum
  • add Decimal.hasFinitePrecision
  • add Decimal.precision
  • add Decimal.scale

Semantic Version Conventions

http://semver.org/

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

1. Depend on it

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


dependencies:
  decimal: "^0.2.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 packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:decimal/decimal.dart';
        
Version Uploaded Documentation Archive
0.2.0 Apr 15, 2018 Go to the documentation of decimal 0.2.0 Download decimal 0.2.0 archive
0.1.4 Jun 16, 2017 Go to the documentation of decimal 0.1.4 Download decimal 0.1.4 archive
0.1.3 Oct 29, 2014 failed Download decimal 0.1.3 archive
0.1.2 Jul 25, 2014 failed Download decimal 0.1.2 archive
0.1.1 Nov 28, 2013 failed Download decimal 0.1.1 archive
0.1.0 Nov 20, 2013 failed Download decimal 0.1.0 archive
0.0.5 Nov 9, 2013 failed Download decimal 0.0.5 archive
0.0.4 Apr 17, 2013 failed Download decimal 0.0.4 archive
0.0.3 Jan 23, 2013 failed Download decimal 0.0.3 archive
0.0.2 Jan 22, 2013 failed Download decimal 0.0.2 archive

All 11 versions...

Analysis

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

  • Dart: 2.0.0-dev.46.0
  • pana: 0.10.6

Scores

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

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

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

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use decimal.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.15.0 <2.0.0
rational ^0.2.0 0.2.0
Dev dependencies
test ^0.12.0