my input not take all numbers after the point


i have an  ej.inputs.NumericTextBox this the configuration 

number = new ej.inputs.NumericTextBox({

                    format: '#.' + '###############',

                    decimals: 15,

                    enabled: false,

                    locale: 'fr',

                    min: -9007199254740991,

                    max: 9007199254740991,


my problem is when i insert an number like 1452147.888888888888888888888888 the result like  

1452147.8888888889 in my case i need to show in my input 15 numbers after the point like this  

  1452147.888888888888889


1 Reply

MR Mallesh Ravi Chandran Syncfusion Team August 7, 2023 05:12 PM UTC

Hi Slavador ,

The behavior you're observing is due to the limitations of JavaScript's floating-point arithmetic. JavaScript uses a standard called international IEEE-754 to represent floating-point numbers, which limits the precision of numbers to 52 bits, or approximately 15 digits. When a number with more than 15 digits is entered, JavaScript rounds the number to the nearest representable floating-point value, which can result in a loss of precision.

 Additionally, we have a public blog that explains the limitations of JavaScript's floating-point arithmetic and provides more information on this topic. You can find the link below:

https://www.w3schools.com/js/js_numbers.asp


In the case of 1452147.888888888888888888888888888, the rounding error that accumulates during conversion and calculations leads to the value being stored as 1452147.8888888889 in binary, which is the closest representable value in the IEEE 754 format.


Regards,

Mallesh 


Loader.
Up arrow icon