Skip to content

[BUG] Precision Loss from Floating Point Math #71

@DeveloperAmrit

Description

@DeveloperAmrit

[y] I have checked for duplicate issues

Description:
Conversion functions for USD equivalents use native JS parseFloat and multipliers like 1e6. This causes rounding errors for large currency amounts.

How to Reproduce:
Call calculateBcUsdEquivalent with a very large amountFloat (e.g., 10^18 wei equivalent).

Actual Behaviour:
Resulting values lose precision after the 15th significant digit, which is unacceptable for financial software.

Expected Behaviour:
All currency calculations must stay within BigInt or a dedicated library like bignumber.js until the final display stage.

Location: StablePay/djed-sdk/src/helpers.js

[y] I want to work on this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions