v-money icon indicating copy to clipboard operation
v-money copied to clipboard

Not working with big Integer

Open minhhoang121296 opened this issue 3 years ago • 2 comments

I tried the sample code mentioned in the docs: https://jsfiddle.net/auom8st8/ When I try to enter a large number (the number of digits is greater than 18), the result is displayed incorrectly Is there a way to solve the problem with user input numbers too large?

minhhoang121296 avatar Aug 11 '20 03:08 minhhoang121296

Hello @minhhoang121296,

I created a version based on this repository with several previous repairs and adding "spinners" (these can be disabled), apparently I also have this problem when I reach 22 digits (the number of digits is reset to 18), I don't know if you mean this? you can try it? https://joserick.com/v_money_spinner

joserick avatar Feb 13 '21 01:02 joserick

@minhhoang121296 @joserick

The MAX_SAFE_INTEGER constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). The reasoning behind that number is that JavaScript uses double-precision floating-point format numbers as specified in IEEE 754 and can only safely represent numbers between -(253 - 1) and 253 - 1.

From Mozilla Javascript Docs

I dont think this is a bug: https://github.com/joserick/v-money-spinner/issues/8

jonathanpmartins avatar May 03 '21 06:05 jonathanpmartins