Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 284247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:26:31+00:00 2026-05-12T05:26:31+00:00

I have a string: {0:16970861903381446063,length:1} I tried converting it to an object using the

  • 0

I have a string:

"{0:16970861903381446063,length:1}"

I tried converting it to an object using the eval method, but it also evaluates the string and hence rounds the numerical value, returning:

{0:16970861903381447000,length:1}

I tried passing the number as a string before calling eval on it,
using 16970861903381446063 + '' as the value when creating the JSON string; checking it with typeof shows it as being of type string, but it still rounds the number 16970861903381446063 to 16970861903381447000.

Is there a way I can bypass this, or a better way to do this?

Following is the code that generates the json text from an array containing the numbers

function simplify(arr){
      request = "{";
      if (arr.length ==1){
         request += 0 +  ":" + (arr[0] + '')  + "," ; 
      }
      else{
         for (var i=0;i<=arr.length-1  ;i++){

        request +=  i +  ":" +  (arr[i] + '')  + ",";
     }
    }
   request += "length" + ":" + arr.length +"}";
   return request;
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:26:31+00:00Added an answer on May 12, 2026 at 5:26 am

    You’re running up against the precision of an IEEE double-precision float, which uses 53 bits for the mantissa and 11 bits for the exponent.

    Javascript numbers, ALL of them, are represented by 64-bit floating point numbers. Floating point numbers in many languages are represented by two parts, a mantissa and an exponent. In Javascript, the mantissa is 53 bits, and the exponent is 11 bits.

    When you see numbers expressed as, for example, 3.5346367e+22, the mantissa is 3.5246367, and the exponent is 22.

    The numbers you are trying to store are larger than the maximum value of the mantissa, so your numbers get rounded, and larger numbers get an exponent.

    Long story short, unless you’re doing arithmetic operations with these huge numbers, you should store them as a string.

    Lastly, you should expressed JSON Arrays as actual JSON Arrays, and not as objects that pretend to be arrays by defining integer keys and a length property:

    // Do this
    json = '["16970861903381446063"]';
    
    // Not this
    json = '{0:"16970861903381446063", length:1}';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have string like \LESSING\root\cimv2:Win32_UserAccount.Domain=LESSING,Name=Admin How to convert it to LESSING\Admin using Framework?
I have string object. I need to pass this data to another object of
I have string containg anonymus function definition, but how i can call this. Lets
I have string Tue Nov 12 2010,I want to parse it in java.util.Date object.
I have string in XML, <italic>a</italic> and I am using xsl:analyze-string to extract all
I have string like this: G:\Projects\TestApp\TestWeb\Files\Upload\file.jpg How can I remove all text before Files
i have string stored in python variables, and i am outputting a html that
I have string looking like this: 'Toy Story..(II) (1995)' I want to split the
I have: String uri = @drawable/myresource.png; How can I load that in ImageView? this.setImageDrawable?
I have string value and Type of some variable (For example int and 32

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.