angular-dynamic-number icon indicating copy to clipboard operation
angular-dynamic-number copied to clipboard

Model Value going to scientific notation

Open kvieira90 opened this issue 8 years ago • 3 comments

When using this directive, losing decimal points and view value is getting distorted after 12 characters before the decimal (the num-int is set to 200). See screenshot

screen shot 2017-02-23 at 12 46 01 pm

screen shot 2017-02-23 at 12 48 37 pm

kvieira90 avatar Feb 23 '17 17:02 kvieira90

Sorry if you've already answerd something like this but I couldn't find it in closed issues

kvieira90 avatar Feb 23 '17 18:02 kvieira90

Than you for your feedback. Very interesting case. I will check it if I can fix it somehow. In this module everything rely on normal js numbers.

uhlryk avatar Mar 12 '17 08:03 uhlryk

Spent some time digging into the problem and the issue lies in the fact that Javascript limits the size of integers to 64-bit floating point values. When you convert the input to Number, it causes the JS engine to automatically convert to scientific notation, thus throwing things off. I removed the conversion to Number, as well as any computation on that number so to get the full number represented in string form and work off that.

kvieira90 avatar Mar 13 '17 12:03 kvieira90