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

Error in specific numbers with max configuration #166

Open
Alejoiss opened this issue Feb 9, 2023 · 0 comments
Open

Error in specific numbers with max configuration #166

Alejoiss opened this issue Feb 9, 2023 · 0 comments

Comments

@Alejoiss
Copy link

Alejoiss commented Feb 9, 2023

I'm trying to use this specific configuration:
<input type="text" currencyMask [options]="{ prefix: 'R$ ', thousands: '.', decimal: ',', allowNegative: false, align: 'left', max: 2.78 }" formControlName="entrada">
When I put the max value, 2.78, it's enter in a infinite loop. It's because the issue in float numbers, in JS. In a determinated line, the lib is trying divide the decimal numbers by 100 and sum with the integer number. So, 2 + (78/100), in JS, is returning 2.7800000000000002. When I try to compare if the number is less then the max (2.7800000000000002 < 2.78), it's call itself again and the infinite loop ocurrs.
It would be interesting if there was a new rounding in the "newValue".
image

PS: i've seen just in this specif number and configuration, but, perhaps, there are some another values that will trigger the same error.

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

1 participant