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

InputNumber: Big Numbers issue #14860

Closed
gregorAutomatics opened this issue Feb 22, 2024 · 2 comments
Closed

InputNumber: Big Numbers issue #14860

gregorAutomatics opened this issue Feb 22, 2024 · 2 comments
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working

Comments

@gregorAutomatics
Copy link

gregorAutomatics commented Feb 22, 2024

Describe the bug

The InputNumber Component overwrites input with wrong values when the number gets too big (over 9999999999999998). Next Digit that is inputted gets increased by one. Subsequent inputs are replaced with 0. When input [format] is set to false it will at some point format to scientific notation and then 'Infinity'.
Occurs in both v16 and v17

Environment

  • Windows
  • Stackblitz

Reproducer

https://stackblitz.com/edit/zuhepy?file=src%2Fapp%2Fdemo%2Finput-number-numerals-demo.html,src%2Fapp%2Fdemo%2Finput-number-numerals-demo.ts,package.json

Angular version

16.x | 17.x

PrimeNG version

16.x | 17.x

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.x

Browser(s)

No response

Steps to reproduce the behavior

  1. Input number larger than 9999999999999998

Expected behavior

input value is not replaced

@gregorAutomatics gregorAutomatics added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 22, 2024
@mehmetcetin01140 mehmetcetin01140 added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 26, 2024
@mehmetcetin01140 mehmetcetin01140 added this to the 17.Future milestone Feb 26, 2024
@zzzaaa
Copy link
Contributor

zzzaaa commented Feb 29, 2024

I believe there might not be a feasible solution to this issue because switching to BigInt as a replacement could potentially break the logic of other applications. This is because BigInts cannot be used interchangeably with regular Numbers, nor can they utilize functions from the Math object.

However, as a workaround, the number-input component could implement a validation check to ensure the input value does not exceed JavaScript's MAX_SAFE_INTEGER limit. By doing so, it can prevent the issue of overflow with the JS number primitive.

Reference: MDN Web Docs on MAX_SAFE_INTEGER

@mehmetcetin01140
Copy link
Contributor

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you open a new issue so we can include it in our roadmap?

Thanks a lot for your understanding!
Best Regards,

@github-project-automation github-project-automation bot moved this to Done in PrimeNG Dec 16, 2024
@mehmetcetin01140 mehmetcetin01140 removed this from the 19.x milestone Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
Status: Done
Development

No branches or pull requests

3 participants