decimal 1.0.0-nullsafety copy "decimal: ^1.0.0-nullsafety" to clipboard
decimal: ^1.0.0-nullsafety copied to clipboard

outdated

The decimal package allows you to deal with decimal numbers without loosing precision.

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

371
likes
0
points
446k
downloads

Publisher

unverified uploader

Weekly Downloads

The decimal package allows you to deal with decimal numbers without loosing precision.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

rational

More

Packages that depend on decimal