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 6159145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:04:57+00:00 2026-05-23T21:04:57+00:00

I have a double in Javascript whose value is, for example, 1.0883076389305e-311. I want

  • 0

I have a double in Javascript whose value is, for example, 1.0883076389305e-311.
I want to express it in the following form, using as example the ‘bc’ utility to calculate the expanded/higher precision/scale form:

$ bc
scale=400
1.0883076389305000*10^-311
.0000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000010883076389305000000000000000\
0000000000000000000000000000000000000000000000000000000000000

I need a Javascript bigint library or code to produce the same output as a string with the expanded/higher precision form of the number.

Thanks!

  • 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-23T21:04:59+00:00Added an answer on May 23, 2026 at 9:04 pm

    This is horrible, but works with every test case I can think of:

    Number.prototype.toFullFixed = function() {
        var s = Math.abs(this).toExponential();
        var a = s.split('e');
        var f = a[0].replace('.', '');
        var d = f.length;
        var e = parseInt(a[1], 10);
        var n = Math.abs(e);
    
        if (e >= 0) {
            n = n - d + 1;
        }
    
        var z = '';
        for (var i = 0; i < n; ++i) {
            z += '0';
        }
    
        if (e <= 0) {
            f = z + f;
            f = f.substring(0, 1) + '.' + f.substring(1);
        } else {
            f = f + z;
            if (n < 0) {
                f = f.substring(0, e + 1) + '.' + f.substring(e + 1);
            }
        }
    
        if (this < 0) {
            f = '-' + f;
        }
    
        return f;
    };
    

    If you find a number that doesn’t parse back correctly, i.e. n !== parseFloat(n.toFullFixed()), please let me know what it is!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this input in a form: <input type=text value=<script src='/js/script.js' type='text/javascript'></script> name=embed/> The
I have a double value f and would like a way to nudge it
I have a Double which could have a value from around 0.000001 to 1,000,000,000.000
i have a double, the decimal place isn't fix (8-?) i want to fix
I have a double thats got a value of something like 0.50000 but I
I have the following line of code: <a href=javascript:; onClick=tweeet('myid')>My Tweets!</a> Now while this
I know in JavaScript, objects double as hashes, but I have been unable to
I have the following javascript snippet, which fails to load due to a missing
I have two JavaScript functions that I want to call from inside of a
I have javascript function (that uses Raphael) that on click select area. On double

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.