Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ packages
.packages
pubspec.lock
.pub/
.dart_tool
.dart_tool

.idea/**
*.iml
3 changes: 2 additions & 1 deletion lib/src/big_decimal.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore_for_file: constant_identifier_names
import 'dart:math' as math;

enum RoundingMode {
UP,
Expand Down Expand Up @@ -163,7 +164,7 @@ class BigDecimal implements Comparable<BigDecimal> {
}

double toDouble() =>
intVal.toDouble() / BigInt.from(10).pow(scale).toDouble();
intVal.toDouble() / math.pow(10.0, scale);
BigInt toBigInt({RoundingMode roundingMode = RoundingMode.UNNECESSARY}) =>
withScale(0, roundingMode: roundingMode).intVal;
int toInt({RoundingMode roundingMode = RoundingMode.UNNECESSARY}) =>
Expand Down
1 change: 1 addition & 0 deletions test/big_decimal_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ void main() {
tabCase([BigInt.from(9223372036854775807).dec, 9223372036854776000.0]),
tabCase([BigInt.from(-9223372036854775808).dec, -9223372036854775808.0]),
tabCase([BigInt.from(-9223372036854775808).dec, -9223372036854776000.0]),
tabCase(['1.0e2'.dec, 100.0]),
]),
);

Expand Down