Skip to content

Rounding issues and unsafe operations #11

@tujlaky

Description

@tujlaky

I think this line in the implementation is not safe it could cause rounding issues:

https://github.com/uzyn/bigdenary/blob/master/mod.ts#L31C7-L31C60

For example the following number will fail: 0.0023537

You can see the problem with this if you try the following calculation:

// 23536.999999999996 instead of 23537
0.0023537 * Math.pow(10, 7)

The response will be a float instead of an integer so it will fail with BigInt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions