decimal 0.1.4

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


To use this library in your code :

  • add a dependency in your pubspec.yaml :
  decimal: ^0.1.3
  • 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


Apache 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

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

  decimal: "^0.1.4"

2. Install it

You can install packages from the command line:

$ 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:decimal/decimal.dart';


A simple package to deal with decimal numbers


Email Alexandre Ardhuin



Source code (hyperlinked)