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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:16:07+00:00 2026-06-07T06:16:07+00:00

Until today I (implicitly) assumed that when I output a BigInteger via the parameterless

  • 0

Until today I (implicitly) assumed that when I output a BigInteger via the parameterless (overridden) instance method BigInteger.ToString() then the return string would contain the complete and exact decimal representation of my “big” integer.

But on the MSDN doc page I read:

“In most cases, the ToString method supports 50 decimal digits of precision. That is, if the BigInteger value has more than 50 digits, only the 50 most significant digits are preserved in the output string; all other digits are replaced with zeros. However, BigInteger supports the “R” standard format specifier, which is intended to round-trip numeric values. The string returned by the ToString(String) method with the “R” format string preserves the whole BigInteger value and can then be parsed with the Parse or TryParse method to restore its original value without any loss of data”._

However, I have not been able to find an example where myBigInt.ToString() differs from myBigInt.ToString("R"). The Remarks example from the above page does not, as claimed, provide an example, in my version of the framework (.NET 4.0 SP1). (Also "G" and "R" seem to be equivalent for BigInteger.)

Is it safe to assume that the paramterless ToString() gives the full decimal expansion of the integer? Did they change framework behavior, or has the above mentioned example code always been wrong?

Note: SO shows me this “similar question” 2984184 after I wrote this one, but I’m still submitting my question because the answer of 2984184 does not really claryfy how the zero-parameter ToString() works.

EDIT BY MYSELF:

It was a bit incosequent of me to link the ToString(String) overload on MSDN when my question is (primarily) about the ToString() overload. So see also MSDN on BigInteger.ToString() which mentions the 50 digits limit as well but does not provide an example with more than 50 digits.

  • 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-06-07T06:16:08+00:00Added an answer on June 7, 2026 at 6:16 am

    Decompiling the .NET 4.0 framework gives this chain of calls:

    BigInteger.ToString
    BigNumber.FormatBigInteger( ... format:= null ...)
    BigNumber.ParseFormatSpecifier(format ...)
    

    within which we have

      if (string.IsNullOrEmpty(format))
        return 'R';
    

    so it can be seen that in this implementation, ToString() is equivalent to ToString("R"). But, as pointed out by @PaulPhillips, given that the docs (slightly confusedly) explicitly disclaim the reliability of this, I would say the safest (and in any case the most self-documenting) thing to do is use “R” when you need full fidelity.

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

Sidebar

Related Questions

Up until earlier today, I was under the impression that if I wanted to
Somehow I never noticed until today that C++ supports nested classes. This surprised me
I have a user that has, up until today, been called foo.bar . Now
I have following code that creates Linq query. I've never used Linq until today
I wrote a heredoc three weeks ago that was working great, and until today
Until today, my understanding of .NET Tuple classes had been that they delegate their
Up until today, all AS3 based game engine (flixel, pushbutton and etc) that I
I didn't notice it until today during some testing locally on my pc, that
Once again, I'm questioning a longstanding belief. Until today, I believed that the alignment
Until today I was living under the impression that RSA encryption using RSA is

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.