We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There should be at least =, <, <=, >, >= on the Decimal type, which does not require unprecise conversion to JS numbers.
=
<
<=
>
>=
Since there is no operator overloading, I suggest interfaces like
a.equals(b) a.isLessThan(b) a.isGreaterThanOrEqual(b)
We need this here:
/** true iff the distributor account needs a refill */ public needsRefill(account: MinimalAccount, tickerSymbol: string): boolean { const meta = this.getTokenMeta(tickerSymbol); const balanceAmount = account.balance.find((b) => b.denom === meta.denom); const balance = balanceAmount ? Decimal.fromAtomics(balanceAmount.amount, meta.fractionalDigits) : Decimal.fromAtomics("0", 0); const thresholdAmount = this.refillThreshold(tickerSymbol); const threshold = Decimal.fromAtomics(thresholdAmount.amount, meta.fractionalDigits); // TODO: perform < operation on Decimal type directly // https://github.com/iov-one/iov-core/issues/1375 return balance.toFloatApproximation() < threshold.toFloatApproximation(); }
It would be good to have a compare funtion that we can use with sort like this
values.sort(Decimal.compare);
and use this to implement the other helpers
Bonus: Extract the function signatures in and interface that we can reuse for the integer types.
The text was updated successfully, but these errors were encountered:
willclarktech
Successfully merging a pull request may close this issue.
There should be at least
=
,<
,<=
,>
,>=
on the Decimal type, which does not require unprecise conversion to JS numbers.Since there is no operator overloading, I suggest interfaces like
We need this here:
It would be good to have a compare funtion that we can use with sort like this
and use this to implement the other helpers
Bonus: Extract the function signatures in and interface that we can reuse for the integer types.
The text was updated successfully, but these errors were encountered: