Skip to content
New issue

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

max/min used with precision > 2 causes stack overflow #132

Open
GenuineRex opened this issue Feb 27, 2021 · 3 comments
Open

max/min used with precision > 2 causes stack overflow #132

GenuineRex opened this issue Feb 27, 2021 · 3 comments

Comments

@GenuineRex
Copy link

this line in the applyMask function limits the mask to using 2 decimal positions when max/min are also used.
The 100 assumes 2 decimal precision and min/max call applyMask again creating a stack overflow.

let newValue = integerValue + (decimalValue / 100);

@thiagosm-tech
Copy link

@GenuineRex 04/2021
(this line in the applyMask function limits the mask to using 2 decimal positions when max/min are also used.
The 100 assumes 2 decimal precision and min/max call applyMask again creating a stack overflow.). problem persists

@hugograf
Copy link

hugograf commented May 5, 2021

The number of digits before the decimal point >= digits after the decimal point - 2 digits. For example, if there are 8 digits after the decimal point, there must be at least 6 digits before the decimal point. Not very suitable for recording Bitcoin transactions.
In the following two examples, the only difference is max:

Works:

public ngxCurrencyOptions: CurrencyMaskConfig = {
    prefix: 'BTC ',
    suffix: '',
    thousands: '\'',
    align: 'right',
    allowZero: true,
    decimal: '.',
    precision: 8,
    allowNegative: true,
    nullable: false,
    min: 0.00000001,
    max: 999_999.99999999,
    inputMode: CurrencyMaskInputMode.NATURAL,
  };

Not working:

  public ngxCurrencyOptions: CurrencyMaskConfig = {
    prefix: 'BTC ',
    suffix: '',
    thousands: '\'',
    align: 'right',
    allowZero: true,
    decimal: '.',
    precision: 8,
    allowNegative: true,
    nullable: false,
    min: 0.00000001,
    max: 99_999.99999999,
    inputMode: CurrencyMaskInputMode.NATURAL,
  };

@joelsantosjunior
Copy link
Contributor

I opened a PR to fix that problem, hope it helps. I was facing the same problem and it fixed my issue. Its a problem related to the decimal precision number, it doesn't work well with numbers > 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants