Skip to content

toDouble() can throw exception due to issue in BigInt #16

@toddobryan

Description

@toddobryan

Try the following:

  BigDecimal bd = BigDecimal.parse("6.6880440087720299389e+806");
  print(bd.toDouble());

I get the following exception:

Unhandled exception:
Invalid argument(s): Exponent must not be negative: -787
#0      _BigIntImpl.pow (dart:core-patch/bigint_patch.dart:1872:7)
#1      BigDecimal.toDouble (package:big_decimal/src/big_decimal.dart:166:43)

It even fails if you change the e+806 to something as small as e+21.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions