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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:53:38+00:00 2026-06-02T06:53:38+00:00

Try debugging the following simple program, and mouse over x in each step (or

  • 0

Try debugging the following simple program, and mouse over x in each step (or “Add Watch” for x or whatever).

using System;
using System.Globalization;

static class Program
{
  static double x;

  static void Main()
  {
    x = 2d;

    // now debugger shows "2.0", as if it has used
    // x.ToString("F1", CultureInfo.InvariantCulture)

    x = 8.0 / 7.0;

    // now debugger shows "1.1428571428571428", as if it had used
    // x.ToString("R", CultureInfo.InvariantCulture)
    // Note that 17 significant figures are shown, not the usual 15.

    x = -1e-200 / 1e200;

    // now debugger shows "0.0"; there is no indication that this is really negative zero
    //

    Console.WriteLine(1.0 / x); // this is negative infinity
  }
}

So, apparently VS has its own way to display a System.Double. Which method does it call for this purpose? Is there a way I can get the very same string representation programmatically?

(Tried this out with Visual Studio 2010 Professional.)

  • 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-02T06:53:40+00:00Added an answer on June 2, 2026 at 6:53 am

    At their core both the C# and VB.Net EE’s use the _ecvt_s function for formatting a double into a string.

    • http://msdn.microsoft.com/en-us/library/ehz2dset(v=vs.80).aspx

    Both do a little bit of cleanup on the resulting string to make the display more C# and VB like and handle some corner cases a bit nicer. Either the _ecvt_s function or the cleanup code could be responsible for the differences you see. Hard to tell at a glance

    Some may ask why we would go through all of this trouble instead of saying just calling ToString on the value and displaying that. There are a couple of reasons we don’t do this.

    The first is simply that function evaluation, even ToString, is the single most expensive action the EE can undertake. Profiles of common real scenarios show that over 98% of our time was spent doing function evaluation. Any time we can avoid a func eval we do because of the performance implications.

    The second reason is simply that function evaluation isn’t always available. There are a number of cases where func eval is unavailable yet people still expect to see a display for primitive types like double, int, etc … Taking them away would essentially kill the debugging experience. Hence we need to solve this problem without ToString support.

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

Sidebar

Related Questions

When debugging the following console program: class Program { static void Main(string[] args) {
Problem Description: Occassionally when debugging, I get the following error. I'm using visual studio
i try to debug a windows gadget. Just-In-Time debugging fires up and i can
I'm having a really difficult time debugging this problem. Whenever I try to establish
Try executing the following in JavaScript: parseInt('01'); //equals 1 parseInt('02'); //equals 2 parseInt('03'); //equals
Try the following code: s = '#value#' puts s.gsub('#value#', Regexp.escape('*')) # => '\*' puts
With the following simple relational database structure: An Order has one or more OrderItems,
I am trying to get remote debugging working with Java on Solaris OS. Following
When I try to do that I get the following error: Changes to 64-bit
Have you managed to get Aptana Studio debugging to work? I tried following this,

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.