Skip to content

[Bug]: The allocate function never ends #771

@ndbac

Description

@ndbac

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

I’m using the allocate function in my application with nestjs, but for these parameters the allocate function never ends or gives an error:

const d = dinero({"amount":337582417582417600000,"currency":{"code":"USD","base":10,"exponent":2},"scale":19});

allocate(d, [0.3, 0.7]);

 const d = dinero({
  amount: -4000040194829794000,

  currency: { code: "SGD", base: 10, exponent: 2 },
  scale: 19,
});

const result = d.allocate([0.15, 0.35, 0.4, 0.1]);

console.log("🚀 ~ result:", JSON.stringify(result));

Expected behavior

It should allocate correctly and return result within a short time

Steps to reproduce

Run this code for reproducing

const d = dinero({"amount":337582417582417600000,"currency":{"code":"USD","base":10,"exponent":2},"scale":19});

allocate(d, [0.3, 0.7]);

 const d = dinero({
  amount: -4000040194829794000,

  currency: { code: "SGD", base: 10, exponent: 2 },
  scale: 19,
});

const result = d.allocate([0.15, 0.35, 0.4, 0.1]);

console.log("🚀 ~ result:", JSON.stringify(result));

Version

^2.0.0-alpha.9

Environment

Node ~18.20.2

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions