Long number are getting converted to exponential format for cells with format type 'Text'

Hello

when we enter long number in Cells with format type 'Text', it automatically get converted exponential format, can we prevent this behavior. 

Please refer following code snippet:
https://stackblitz.com/edit/angular-scztur-dovjjk?file=app.component.ts
(Pay attention to ID column in this spreadsheet)  


5 Replies

SP Sangeetha Priya Murugan Syncfusion Team September 14, 2023 01:33 PM UTC

Hi Mayank,


We have validated your provided sample and the reported issue occurs in our end, but it refers one of our older versions(19.4.40). We have included many features, improvements, and bug fixes in our latest releases. And your reported issue fixed in our latest version. So, we would suggest you use our latest version (22.2.12) to resolve this issue in your end. For your convenience, we have prepared the sample and video demonstration of this. Please find the link below.


Sample Link: https://stackblitz.com/edit/angular-gdnfkv?file=src%2Fapp.component.ts,package.json


Attachment: screencapture_aea9762f.zip


GT Glenn Turner May 6, 2025 08:22 AM UTC

Hi,

We're still getting this same issue in version 28.1.33. Can you please confirm what version this has been fixed in?

Thanks





DM Dinakar Manickam Syncfusion Team May 9, 2025 02:28 PM UTC

Hi Glenn Turner,


We have validated your query regarding the long numbers being automatically converted to scientific (exponential) format, even when the cell format is set to 'Text'.


We reviewed the sample provided in the previous update and observed that the long numbers are being populated through a dataSource. Upon further investigation, we found that when entering or binding large numbers to the spreadsheet, our implementation relies on JavaScript functions such as parseFloat and Number to process string values as numbers. However, if a value exceeds JavaScript’s Number.MAX_SAFE_INTEGER (i.e., 9007199254740991), it is often represented in scientific notation.


This behavior is due to the limitations of JavaScript's number handling, which follows the IEEE 754 double-precision floating-point standard. JavaScript can accurately represent numbers only up to 15–16 digits. Numbers exceeding this limit may lose precision or be automatically displayed in scientific format to indicate their size and potential inaccuracy.

For instance:

  • 12345567890123457000 — Not shown in scientific format: Despite exceeding the safe integer limit, this number has trailing zeros that make it easier for JavaScript to round and represent in standard notation.
  • 12345567890123456789999999 — Shown in scientific format: Due to the number of significant digits and its size, JavaScript cannot represent it precisely and converts it to scientific notation (e.g., 1.2345567890123456e+25).


For further details regarding these functions and their limitations, please refer to the following links:

At this time, there are no alternative solutions to display large numbers exactly as entered due to JavaScript limitations. However, we have considered this as a valid improvement request and logged it as a feature. It will be included in one of our upcoming releases. You can track the status and communicate about this feature through the following link on our feedback portal:


Feedback link:
 https://www.syncfusion.com/feedback/62893/provide-support-to-display-large-number-without-converting-it-as-scientific


At the planning stage for every release cycle, we review all the open features once again and finalize features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. Once we have anything definite to share about these features implementation, we will move the feedback to scheduled status with the tentative release timeline.


We appreciate your patience until then.


To prevent conversion of long numbers to scientific notation:

To avoid long numbers being converted to scientific notation, ensure the affected cells are explicitly formatted as 'Text' before entering the values. For example, apply the 'Text' format to a specific range like B1:B10 using the number format dropdown in the spreadsheet. Then, input the long number values in this range. This prevents JavaScript from interpreting and converting them into scientific notation.


Additionally, you can set the 'Text' format for a specific range of cells programmatically using the numberFormat method of the Spreadsheet component, as shown in the code snippet below:


Code Snippet:

created() {

        this.spreadsheetObj.numberFormat('@', 'B1:B200');

    }


For your reference, we’ve attached a working sample and a video demonstration showing the correct approach.

Sample Link: Ovpskzk6 (forked) - StackBlitz

Video Link: Please check the attachment below.


Please check the above details and feel free to contact us for further clarifications.


Best Regards,
Dinakar M


Attachment: Video_F184549_1040b184.zip


JU Jawad ul Hassan May 10, 2025 06:18 AM UTC

To prevent long numbers from turning into exponential format, prefix them with a single quote like this: '12345678901234567890'. This keeps them as plain text.



DM Dinakar Manickam Syncfusion Team May 13, 2025 03:14 PM UTC

Hi Jawad ul Hassan,


You are correct, when a long numeric value is prefixed with a single quote in our Spreadsheet component, it is treated as a text value, not as a number. However, please note that the single quote is also stored in the cell, making the value a string rather than a numeric representation. We’ve shared a screenshot below to illustrate this behavior.


Screenshot:


As mentioned in our previous update, when string values or large numbers are bound to the Spreadsheet through a dataSource, our component uses JavaScript functions like parseFloat and Number to process and interpret those values as numbers. However, if a numeric value exceeds JavaScript’s Number.MAX_SAFE_INTEGER (i.e., 9007199254740991), it may be represented in scientific notation due to JavaScript’s numeric limitations.


This behavior is due to the limitations of JavaScript's number handling, which follows the IEEE 754 double-precision floating-point standard. JavaScript can accurately represent numbers only up to 15–16 digits. Numbers exceeding this limit may lose precision or be automatically displayed in scientific format to indicate their size and potential inaccuracy.


For further details regarding these functions and their limitations, please refer to the following links:


Due to limitations in JavaScript number precision, it is currently not possible to display very large numbers exactly as loaded when using the dataSource property in the Spreadsheet component. However, we have considered this as a valid improvement request and logged it as a feature. It will be included in any of our upcoming releases. You can track the status and communicate about this feature through the following link on our feedback portal:


Feedback link:
 https://www.syncfusion.com/feedback/62893/provide-support-to-display-large-number-without-converting-it-as-scientific


At the planning stage for every release cycle, we review all the open features once again and finalize features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. Once we have anything definite to share about these features implementation, we will move the feedback to scheduled status with the tentative release timeline.


We appreciate your patience until then.

Best Regards,
Dinakar M


Loader.
Up arrow icon