473,699 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Number of digits in exponent with "g" format?

Hello,

By default, the "g" format specifier seems to use 2 digits in the exponent
if it decides to use the scientific format. I.e., Double.ToString ("g"). How
do I control the number of exponent digits used without affecting the
operation of "g" in any other way? I need it to use 3 digits instead.

Thanks,
Ray
Jul 17 '08 #1
3 4327
Ray Mitchell wrote:
By default, the "g" format specifier seems to use 2 digits in the exponent
if it decides to use the scientific format. I.e., Double.ToString ("g"). How
do I control the number of exponent digits used without affecting the
operation of "g" in any other way? I need it to use 3 digits instead.
Something like x.ToString("e") or x.ToString("0.0 0000000e+000") will
always use scientific format with 3 digits in the exponent.

Arne
Jul 18 '08 #2


"Arne Vajhøj" wrote:
Ray Mitchell wrote:
By default, the "g" format specifier seems to use 2 digits in the exponent
if it decides to use the scientific format. I.e., Double.ToString ("g"). How
do I control the number of exponent digits used without affecting the
operation of "g" in any other way? I need it to use 3 digits instead.

Something like x.ToString("e") or x.ToString("0.0 0000000e+000") will
always use scientific format with 3 digits in the exponent.

Arne
Yes, but I don't always want scientific. I want it to be done like "g" does
it except that when it does "choose" scientific, it uses 3 digits of exponent
instead of 2.
Jul 18 '08 #3
Ray Mitchell wrote:
"Arne Vajhøj" wrote:
>Ray Mitchell wrote:
>>By default, the "g" format specifier seems to use 2 digits in the exponent
if it decides to use the scientific format. I.e., Double.ToString ("g"). How
do I control the number of exponent digits used without affecting the
operation of "g" in any other way? I need it to use 3 digits instead.
Something like x.ToString("e") or x.ToString("0.0 0000000e+000") will
always use scientific format with 3 digits in the exponent.

Yes, but I don't always want scientific. I want it to be done like "g" does
it except that when it does "choose" scientific, it uses 3 digits of exponent
instead of 2.
Unfortunately there does not seem to be support for that in
..NET (NumberFormatIn fo).

You will have to find the borders and write some code
that tests for inside/outside and call code accordingly.

Arne
Jul 19 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2934
by: martin.mrazek | last post by:
Hello, I wanted to install Number::Format module bud ended up with following error message. Does anybody have any suggestion what the cause could be?? Could that be due to presence of perldl in my comp? Martin # make cp Format.pm blib/lib/Number/Format.pm Manifying blib/man3/Number::Format.3pm
3
2428
by: John H. | last post by:
Hi, Why if set a DataTable in Crystal Report Net Table with method SetDataSource, 'ReportDocument.SetDataSource(oDataTable)', lost the Number and Currency format with the decimal digits and Currency symbol?
1
8857
by: Nick | last post by:
Well, the project I am working on has now come to a screeching halt! I have been developing a program that heavily utilizes ADO.NET record sets. To generate reports, I convert the recordset to XML, and then apply an XSLT to transform the XML into HTML. This works great (or did) until today. I just found out that the "number-format" command in XSLT can't handle scientific notation! So when I try to format these numbers I just get "NaN" on...
0
1100
by: moondog | last post by:
I would like my project to have its version numbers in the 1.2.3.4 format; however, whenever I change the "version" property in my setup deployment project I get this error "C:\myprogram\Setup_Projects\xyz\Setup - xyz.vdproj Invalid product version '1.2.3.4'. Must be of format '##.##.####' It does accept a version number with only two decimal points: 1.2.34 However, my company would like to see a four number format version number:...
0
1840
by: richasaraf | last post by:
Hi all, Please help me out... i want to convert the to_char into number format.... please let em know how to do it... for eg: i have a statement : to_char(p_number, 'S000000') this converts the number into proper format.... now i want to convert tht 'S000000' char back to the original number p_number..... Can anyone tell me how to do it please :confused: Thanks a lot
1
1256
by: ADA | last post by:
Hi all, I have a funny problem. I have a function in Windows Application, which builds dataset in run time, adds data into the dataset and returns XML. One of dataset columns has System.Double type. If I try to insert into this column number in format "###0.00", in the output XML I'll recieve for example "123.45". It works fine. But, if I try to run the same code from the webmethod , I recieve error number format (without "."), for...
0
2503
by: Wayne | last post by:
I am charting data from a query that consists of a Date/Time field and a Number field. The Date/Time field is the x scale on my chart. Sometimes data is collected from different times during the one day. I need to be able to see these times as different time points on the x scale of my chart. To accomplish this I am using the following statement as the row source for my chart: "SELECT (Format(,"DDDDD HAMPM")),Max() AS FROM GROUP BY...
10
13712
by: Dixie | last post by:
I am appending some new fields to a table in vba and when I append a number field with is a byte, it does not inherit any format. I want it to be the General Number format, but it is blank. I have tried to change the format with the following code, but it does not work. What is wrong with this code and how can I make that byte number field have the General Number format? Call...
6
2917
by: psbasha | last post by:
I have a input format XX:YY:ZZ and the start value may be 'n' digit numbers for X,Y,Z. So I have to assign the numbers based on the above format ( Format may change) Say Example - 1 Inputs :
1
4586
by: michaelw118 | last post by:
Hi, I hope someone can give me some solutions to these problems I faced. I imported some data to Excel. Then in Access, I table-linked to this file. I have two fields which in Excel is in number format but in Access, these fields property is text and the values in these fields become "#Num!". Others number format fields were okay, only these two fields (or particular columns?). But if I linked directly to the datasource, it seems the...
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9054
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7778
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6545
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3071
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.