decimal 0.3.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 94

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

0.3.2 (2018-07-24)

  • migration to Dart 2.

v0.3.1 (2018-07-10)

  • make Decimal.parse a factory constructor.

v0.3.0 (2018-07-10)

  • allow parsing of 1.

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.

example/example.dart

import 'package:decimal/decimal.dart';

void main() {
  print(Decimal.parse('0.1') + Decimal.parse('0.2'));
}

Use this package as a library

1. Depend on it

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


dependencies:
  decimal: ^0.3.2

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:decimal/decimal.dart';
  
Version Uploaded Documentation Archive
0.3.2 Jul 24, 2018 Go to the documentation of decimal 0.3.2 Download decimal 0.3.2 archive
0.3.1 Jul 10, 2018 Go to the documentation of decimal 0.3.1 Download decimal 0.3.1 archive
0.3.0 Jul 10, 2018 Go to the documentation of decimal 0.3.0 Download decimal 0.3.0 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 Go to the documentation of decimal 0.1.3 Download decimal 0.1.3 archive
0.1.2 Jul 25, 2014 Go to the documentation of decimal 0.1.2 Download decimal 0.1.2 archive
0.1.1 Nov 28, 2013 Go to the documentation of decimal 0.1.1 Download decimal 0.1.1 archive
0.1.0 Nov 20, 2013 Go to the documentation of decimal 0.1.0 Download decimal 0.1.0 archive
0.0.5 Nov 9, 2013 Go to the documentation of decimal 0.0.5 Download decimal 0.0.5 archive

All 14 versions...

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

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.66.0 <3.0.0
rational ^0.3.0 0.3.1
Dev dependencies
test ^1.2.0